SYSMIS

classic Classic list List threaded Threaded
6 messages Options
Tom
Reply | Threaded
Open this post in threaded view
|

SYSMIS

Tom

Hello List

 

 

I’d like to compute a new variable funktion using IF-Commands. One possible condition is, that the value is equal to System Missing.

 

IF(anstellungsgrad_lp  = 0 OR anstellungsgrad_lp EQ Sysmis AND anstellungsgrad_sl GT 0) funktion = 1.

 

PASW 18.0 doesn’t accept this writing.Probably it won’t help to treat Sysmis as String like ‘sysmis’ because there’s no string…

But there are cases with Sysmis in the variable anstellungsgrad_lp, which I want to include. What can I do?

 

Thanks for any hint.

Tom

Reply | Threaded
Open this post in threaded view
|

Re: SYSMIS

Bruce Weaver
Administrator
Balmer Thomas wrote
Hello List

I'd like to compute a new variable funktion using IF-Commands. One
possible condition is, that the value is equal to System Missing.

IF(anstellungsgrad_lp  = 0 OR anstellungsgrad_lp EQ Sysmis AND
anstellungsgrad_sl GT 0) funktion = 1.
 

PASW 18.0 doesn't accept this writing.Probably it won't help to treat
Sysmis as String like 'sysmis' because there's no string...

But there are cases with Sysmis in the variable anstellungsgrad_lp,
which I want to include. What can I do?

Thanks for any hint.

Tom
Use the SYSMIS function, like this:

IF(anstellungsgrad_lp  = 0 OR Sysmis(anstellungsgrad_lp) AND anstellungsgrad_sl GT 0) funktion = 1.

Or, because the first two conditions concern the same variable, you could use ANY, like this:

IF ANY(anstellungsgrad_lp,0,$SYSMIS) AND (anstellungsgrad_sl GT 0) funktion = 1.


--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: SYSMIS

Rick Oliver-3
In reply to this post by Tom

Use the sysmis function, as in:

if sysmis(varname)...


From: Balmer Thomas <[hidden email]>
To: [hidden email]
Date: 07/21/2010 09:55 AM
Subject: SYSMIS
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Hello List
 
 
I’d like to compute a new variable funktion using IF-Commands. One possible condition is, that the value is equal to System Missing.
 
IF(anstellungsgrad_lp  = 0 OR anstellungsgrad_lp EQ Sysmis AND anstellungsgrad_sl GT 0) funktion = 1.
 
PASW 18.0 doesn’t accept this writing.Probably it won’t help to treat Sysmis as String like ‘sysmis’ because there’s no string…
But there are cases with Sysmis in the variable anstellungsgrad_lp, which I want to include. What can I do?
 
Thanks for any hint.
Tom

Reply | Threaded
Open this post in threaded view
|

Re: SYSMIS

Marks, Jim
In reply to this post by Tom

The structure is

   IF SYSMIS(number)...

 

For string variable

   IF LEN(RTRIM(string) = 0...

 

SPSS strings are padded with blanks to fill the defined length: If a variable is defined as A5, then the actual variables will be:

‘i____‘      (4 space “characters” replaced with underscore)

‘am___‘   (3 space “characters” replaced with underscore )

‘ready’     (0 space “characters” replaced with underscore )

 

 

 

Jim Marks

Director, Market Research

x1616

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Balmer Thomas
Sent: Wednesday, July 21, 2010 9:53 AM
To: [hidden email]
Subject: SYSMIS

 

Hello List

 

 

I’d like to compute a new variable funktion using IF-Commands. One possible condition is, that the value is equal to System Missing.

 

IF(anstellungsgrad_lp  = 0 OR anstellungsgrad_lp EQ Sysmis AND anstellungsgrad_sl GT 0) funktion = 1.

 

PASW 18.0 doesn’t accept this writing.Probably it won’t help to treat Sysmis as String like ‘sysmis’ because there’s no string…

But there are cases with Sysmis in the variable anstellungsgrad_lp, which I want to include. What can I do?

 

Thanks for any hint.

Tom

Reply | Threaded
Open this post in threaded view
|

Re: SYSMIS

John F Hall
In reply to this post by Tom
Busy on something else, but off the top of my head, try adding some brackets:
 
IF((anstellungsgrad_lp  = 0) OR (anstellungsgrad_lp EQ Sysmis)) AND (anstellungsgrad_sl GT 0) funktion = 1.
 
Otherwise try something like:
 
count dummy = anstellungsgrad_lp  (0) anstellungsgrad_lp (sysmis) anstellungsgrad_sl (1 thru hi) .
if dummy ge 2 funktion = 1 .
 
You might need to substitute the highest valid value for HI above, especially if there are ni=o missing values declared.
 
----- Original Message -----
Sent: Wednesday, July 21, 2010 4:52 PM
Subject: SYSMIS

Hello List

 

 

I’d like to compute a new variable funktion using IF-Commands. One possible condition is, that the value is equal to System Missing.

 

IF(anstellungsgrad_lp  = 0 OR anstellungsgrad_lp EQ Sysmis AND anstellungsgrad_sl GT 0) funktion = 1.

 

PASW 18.0 doesn’t accept this writing.Probably it won’t help to treat Sysmis as String like ‘sysmis’ because there’s no string…

But there are cases with Sysmis in the variable anstellungsgrad_lp, which I want to include. What can I do?

 

Thanks for any hint.

Tom

Reply | Threaded
Open this post in threaded view
|

Re: SYSMIS

Bruce Weaver
Administrator
In reply to this post by Bruce Weaver
Bruce Weaver wrote
Balmer Thomas wrote
Hello List

I'd like to compute a new variable funktion using IF-Commands. One
possible condition is, that the value is equal to System Missing.

IF(anstellungsgrad_lp  = 0 OR anstellungsgrad_lp EQ Sysmis AND
anstellungsgrad_sl GT 0) funktion = 1.
 

PASW 18.0 doesn't accept this writing.Probably it won't help to treat
Sysmis as String like 'sysmis' because there's no string...

But there are cases with Sysmis in the variable anstellungsgrad_lp,
which I want to include. What can I do?

Thanks for any hint.

Tom
Use the SYSMIS function, like this:

IF(anstellungsgrad_lp  = 0 OR Sysmis(anstellungsgrad_lp) AND anstellungsgrad_sl GT 0) funktion = 1.

Or, because the first two conditions concern the same variable, you could use ANY, like this:

IF ANY(anstellungsgrad_lp,0,$SYSMIS) AND (anstellungsgrad_sl GT 0) funktion = 1.
I should have tested the second method above.  Ruben alerted me to the fact that it doesn't work as I expected it to.  Here's a modification of the example he sent me off-list.

data list free/sex var1.
begin data
1 ''
1 2
1 3
0 ''
0 2
0 3
end data.

compute test1=any(var1,$sysmis,2).
compute test2 = (var1 EQ 2) or sysmis(var1).
list.

Output:

    sex    var1    test1    test2

      1       .        .        1
      1       2        1        1
      1       3        0        0
      0       .        .        1
      0       2        1        1
      0       3        0        0

Notice that when VAR1 = SYSMIS, TEST1 is set to SYSMIS.  The method used for computing TEST2 works as expected, however.

Thanks Ruben.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).