Compute command and System User missing

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

Compute command and System User missing

J McClure
Hi,
I'm a doctoral student (epidemiology)and have not used SPSS in awhile. I'm
trying to do something quite simple but am running into a problem with
system missing and user missing values.
Old variables are H_now (no missing values) and H_12mo which has 3 system
missing and 7 user missing (99).
I want to create a new variable (hosp). I set the new variable to 8 so that
any cases that "fall thru" will be evident to me. Indeed, 10 cases fall thru
and are listed as an "8". These are the 3 sysmis and the 7 user missing (99).
compute hosp=8.
if H_now EQ 1  hosp = 1.
if (H_now EQ 0 and H_12mo EQ 1) hosp = 2.
if (H_now EQ 0 and H_12mo EQ 0) hosp = 3.
If H_12mo EQ 99  hosp = 98.
Variable labels hosp 'outcome'.
Value labels hosp 3 'no event' 2'12 mo event' 1'immediate event'.
Freq
/var=hosp
/missing=include.
Thanks for any help,
Jan

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Compute command and System User missing

Rich Ulrich
You are not totally explicit about what the problem is.
Presumably, "eq 99" does not work because 99 is missing.

One obvious correction is to un-MISS  99 for H_12mo  before the
computation (using MISSING VALUES h_12mo ( ) ); and re-instate
it at the end.  The more direct correction uses the SYSMIS( )
function.

Apparently, you want the value to be 98 if H_12mo was 99,
and 8 if it was SYSMIS.  Thus -- make the initializing of Hosp
set it to 98; and change the test at the end to

IF   SYSMIS(H_12mo)  hosp= 8.

 - If there is a function that tests for MISSING, but not SYSMIS,
you could use that one in place of the present test on 99.
But I don't remember that name, and quick Googling doesn't
show it to me.

--
Rich Ulrich
> Date: Thu, 3 Nov 2011 12:26:12 -0400

> From: [hidden email]
> Subject: Compute command and System User missing
> To: [hidden email]
>
> Hi,
> I'm a doctoral student (epidemiology)and have not used SPSS in awhile. I'm
> trying to do something quite simple but am running into a problem with
> system missing and user missing values.
> Old variables are H_now (no missing values) and H_12mo which has 3 system
> missing and 7 user missing (99).
> I want to create a new variable (hosp). I set the new variable to 8 so that
> any cases that "fall thru" will be evident to me. Indeed, 10 cases fall thru
> and are listed as an "8". These are the 3 sysmis and the 7 user missing (99).
> compute hosp=8.
> if H_now EQ 1 hosp = 1.
> if (H_now EQ 0 and H_12mo EQ 1) hosp = 2.
> if (H_now EQ 0 and H_12mo EQ 0) hosp = 3.
> If H_12mo EQ 99 hosp = 98.
> Variable labels hosp 'outcome'.
> Value labels hosp 3 'no event' 2'12 mo event' 1'immediate event'.
> Freq
> /var=hosp
> /missing=include.
[ ... ]
Reply | Threaded
Open this post in threaded view
|

Re: Compute command and System User missing

J McClure
Hi,
Sorry, I see that I wasn't specific.
The results of the code I posted are 10 cases that fall into the category of 8.  I am using 8 only to see where my code does not work. In other words, if there are any '8' s in my new variable I did something wrong.
I traced the source of my 10 cases that were incorrectly coded as an '8' to the variable h_12mo which has 7 cases that are user missing (coded as 99) and 3 cases that are system missing. 
In the new variable I want the user missing to be a 98 and the system missing to still be system missing.
Thanks,
Jan

On 11/3/2011 10:37 AM, Rich Ulrich wrote:
You are not totally explicit about what the problem is.
Presumably, "eq 99" does not work because 99 is missing.

One obvious correction is to un-MISS  99 for H_12mo  before the
computation (using MISSING VALUES h_12mo ( ) ); and re-instate
it at the end.  The more direct correction uses the SYSMIS( )
function.

Apparently, you want the value to be 98 if H_12mo was 99,
and 8 if it was SYSMIS.  Thus -- make the initializing of Hosp
set it to 98; and change the test at the end to

IF   SYSMIS(H_12mo)  hosp= 8.

 - If there is a function that tests for MISSING, but not SYSMIS,
you could use that one in place of the present test on 99.
But I don't remember that name, and quick Googling doesn't
show it to me.

--
Rich Ulrich
> Date: Thu, 3 Nov 2011 12:26:12 -0400
> From: [hidden email]
> Subject: Compute command and System User missing
> To: [hidden email]
>
> Hi,
> I'm a doctoral student (epidemiology)and have not used SPSS in awhile. I'm
> trying to do something quite simple but am running into a problem with
> system missing and user missing values.
> Old variables are H_now (no missing values) and H_12mo which has 3 system
> missing and 7 user missing (99).
> I want to create a new variable (hosp). I set the new variable to 8 so that
> any cases that "fall thru" will be evident to me. Indeed, 10 cases fall thru
> and are listed as an "8". These are the 3 sysmis and the 7 user missing (99).
> compute hosp=8.
> if H_now EQ 1 hosp = 1.
> if (H_now EQ 0 and H_12mo EQ 1) hosp = 2.
> if (H_now EQ 0 and H_12mo EQ 0) hosp = 3.
> If H_12mo EQ 99 hosp = 98.
> Variable labels hosp 'outcome'.
> Value labels hosp 3 'no event' 2'12 mo event' 1'immediate event'.
> Freq
> /var=hosp
> /missing=include.
[ ... ]
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Compute command and System User missing

John F Hall
In reply to this post by J McClure
Jan

Try taking the slash out of your freq command:

freq hosp /mis inc.     [abbreviated syntax]

Not sure exactly what you've done with missing values or what they are, but
SPSS only allows 3.  However you can cram a range of values of yours into

missing values <varlist> (<val1> thru <val2>) which only uses two and leaves
you a spare.

Hope this helps.  There are 400+ pages of syntax-based tutorials on my
website, all centred on data from questionnaire surveys, if that's of
interest.  I can possibly be of more help if you send me (off-list) an
extract of your *.sav file and your *.sps file as attachments (no charge).

John F Hall

[hidden email]
www.surveyresearch.weebly.com




-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jan
McClure
Sent: 03 November 2011 17:26
To: [hidden email]
Subject: Compute command and System User missing

Hi,
I'm a doctoral student (epidemiology)and have not used SPSS in awhile. I'm
trying to do something quite simple but am running into a problem with
system missing and user missing values.
Old variables are H_now (no missing values) and H_12mo which has 3 system
missing and 7 user missing (99).
I want to create a new variable (hosp). I set the new variable to 8 so that
any cases that "fall thru" will be evident to me. Indeed, 10 cases fall thru
and are listed as an "8". These are the 3 sysmis and the 7 user missing
(99).
compute hosp=8.
if H_now EQ 1  hosp = 1.
if (H_now EQ 0 and H_12mo EQ 1) hosp = 2.
if (H_now EQ 0 and H_12mo EQ 0) hosp = 3.
If H_12mo EQ 99  hosp = 98.
Variable labels hosp 'outcome'.
Value labels hosp 3 'no event' 2'12 mo event' 1'immediate event'.
Freq
/var=hosp
/missing=include.
Thanks for any help,
Jan

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Compute command and System User missing

Rich Ulrich
In reply to this post by J McClure
>Date: Thu, 3 Nov 2011 10:46:06 -0700
>From: [hidden email]
>Subject: Re: Compute command and System User missing
>To: [hidden email]
>
> Hi,
>Sorry, I see that I wasn't specific.
>The results of the code I posted are 10 cases that fall into the category of 8.  I am using 8 only to see where my code does not work. In other words, if there are any '8' s in my new variable I did something wrong.
>I traced the source of my 10 cases that were incorrectly coded as an '8' to the variable h_12mo which has 7 cases that are user missing (coded as 99) and 3 cases that are system missing. 
>In the new variable I want the user missing to be a 98 and the system missing to still be system missing.
>Thanks,


The Keyword is $sysmis.  You still start with COMPUTE hosp=98.

The final IF becomes

IF   SYSMIS(H_12mo)  hosp= $sysmis.


--
Rich Ulrich

**************previous
On 11/3/2011 10:37 AM, Rich Ulrich wrote:
You are not totally explicit about what the problem is.
Presumably, "eq 99" does not work because 99 is missing.

One obvious correction is to un-MISS  99 for H_12mo  before the
computation (using MISSING VALUES h_12mo ( ) ); and re-instate
it at the end.  The more direct correction uses the SYSMIS( )
function.

Apparently, you want the value to be 98 if H_12mo was 99,
and 8 if it was SYSMIS.  Thus -- make the initializing of Hosp
set it to 98; and change the test at the end to

IF   SYSMIS(H_12mo)  hosp= 8.

 - If there is a function that tests for MISSING, but not SYSMIS,
you could use that one in place of the present test on 99.
But I don't remember that name, and quick Googling doesn't
show it to me.

--
Rich Ulrich
> Date: Thu, 3 Nov 2011 12:26:12 -0400
> From: [hidden email]
> Subject: Compute command and System User missing
> To: [hidden email]
>
> Hi,
> I'm a doctoral student (epidemiology)and have not used SPSS in awhile. I'm
> trying to do something quite simple but am running into a problem with
> system missing and user missing values.
> Old variables are H_now (no missing values) and H_12mo which has 3 system
> missing and 7 user missing (99).
> I want to create a new variable (hosp). I set the new variable to 8 so that
> any cases that "fall thru" will be evident to me. Indeed, 10 cases fall thru
> and are listed as an "8". These are the 3 sysmis and the 7 user missing (99).
> compute hosp=8.
> if H_now EQ 1 hosp = 1.
> if (H_now EQ 0 and H_12mo EQ 1) hosp = 2.
> if (H_now EQ 0 and H_12mo EQ 0) hosp = 3.
> If H_12mo EQ 99 hosp = 98.
> Variable labels hosp 'outcome'.
> Value labels hosp 3 'no event' 2'12 mo event' 1'immediate event'.
> Freq
> /var=hosp
> /missing=include.
[ ... ]

Reply | Threaded
Open this post in threaded view
|

Re: Compute command and System User missing

Robin Darton

Dear Jan,

 

The VALUE function can be used to ignore user missing-value definitions and return the actual value. In your example, you could use:

 

If VALUE(H_12mo) EQ 99 hosp = 98.

See p.121 in the PASW Statistics 18 Command Syntax Reference.

 

Hope this helps.

 

Robin Darton.

 

 

--

Robin A. Darton,

Senior Research Fellow,

Personal Social Services Research Unit,

University of Kent,

Canterbury,

Kent CT2 7NF,

U.K.

Tel: +44(0)1227 827643

Fax: +44(0)1227 827038

E-Mail: [hidden email]

Website: http://www.PSSRU.ac.uk/

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Rich Ulrich
Sent: 03 November 2011 18:02
To: [hidden email]
Subject: Re: Compute command and System User missing

 

>Date: Thu, 3 Nov 2011 10:46:06 -0700

>From: [hidden email]
>Subject: Re: Compute command and System User missing
>To: [hidden email]
>
> Hi,
>Sorry, I see that I wasn't specific.
>The results of the code I posted are 10 cases that fall into the category of 8.  I am using 8 only to see where my code does not work. In other words, if there are any '8' s in my new variable I did something wrong.
>I traced the source of my 10 cases that were incorrectly coded as an '8' to the variable h_12mo which has 7 cases that are user missing (coded as 99) and 3 cases that are system missing. 
>In the new variable I want the user missing to be a 98 and the system missing to still be system missing.
>Thanks,


The Keyword is $sysmis.  You still start with COMPUTE hosp=98.

The final IF becomes

IF   SYSMIS(H_12mo)  hosp= $sysmis.


--
Rich Ulrich

**************previous
On 11/3/2011 10:37 AM, Rich Ulrich wrote:

You are not totally explicit about what the problem is.
Presumably, "eq 99" does not work because 99 is missing.

One obvious correction is to un-MISS  99 for H_12mo  before the
computation (using MISSING VALUES h_12mo ( ) ); and re-instate
it at the end.  The more direct correction uses the SYSMIS( )
function.

Apparently, you want the value to be 98 if H_12mo was 99,
and 8 if it was SYSMIS.  Thus -- make the initializing of Hosp
set it to 98; and change the test at the end to

IF   SYSMIS(H_12mo)  hosp= 8.

 - If there is a function that tests for MISSING, but not SYSMIS,
you could use that one in place of the present test on 99.
But I don't remember that name, and quick Googling doesn't
show it to me.

--
Rich Ulrich

> Date: Thu, 3 Nov 2011 12:26:12 -0400


> From: [hidden email]
> Subject: Compute command and System User missing
> To: [hidden email]
>
> Hi,
> I'm a doctoral student (epidemiology)and have not used SPSS in awhile. I'm
> trying to do something quite simple but am running into a problem with
> system missing and user missing values.
> Old variables are H_now (no missing values) and H_12mo which has 3 system
> missing and 7 user missing (99).
> I want to create a new variable (hosp). I set the new variable to 8 so that
> any cases that "fall thru" will be evident to me. Indeed, 10 cases fall thru
> and are listed as an "8". These are the 3 sysmis and the 7 user missing (99).
> compute hosp=8.
> if H_now EQ 1 hosp = 1.
> if (H_now EQ 0 and H_12mo EQ 1) hosp = 2.
> if (H_now EQ 0 and H_12mo EQ 0) hosp = 3.
> If H_12mo EQ 99 hosp = 98.
> Variable labels hosp 'outcome'.
> Value labels hosp 3 'no event' 2'12 mo event' 1'immediate event'.
> Freq
> /var=hosp
> /missing=include.
[ ... ]

 

Reply | Threaded
Open this post in threaded view
|

Re: Compute command and System User missing

David Marso
Administrator
In reply to this post by Rich Ulrich
"
 - If there is a function that tests for MISSING, but not SYSMIS,
you could use that one in place of the present test on 99.
But I don't remember that name, and quick Googling doesn't
show it to me. "

IF (VALUE( H_12mo) EQ  99) hosp=8.

;-)))




Rich Ulrich-2 wrote
You are not totally explicit about what the problem is.
Presumably, "eq 99" does not work because 99 is missing.

One obvious correction is to un-MISS  99 for H_12mo  before the
computation (using MISSING VALUES h_12mo ( ) ); and re-instate
it at the end.  The more direct correction uses the SYSMIS( )
function.

Apparently, you want the value to be 98 if H_12mo was 99,
and 8 if it was SYSMIS.  Thus -- make the initializing of Hosp
set it to 98; and change the test at the end to

IF   SYSMIS(H_12mo)  hosp= 8.

 - If there is a function that tests for MISSING, but not SYSMIS,
you could use that one in place of the present test on 99.
But I don't remember that name, and quick Googling doesn't
show it to me.

--
Rich Ulrich
> Date: Thu, 3 Nov 2011 12:26:12 -0400
> From: [hidden email]
> Subject: Compute command and System User missing
> To: [hidden email]
>
> Hi,
> I'm a doctoral student (epidemiology)and have not used SPSS in awhile. I'm
> trying to do something quite simple but am running into a problem with
> system missing and user missing values.
> Old variables are H_now (no missing values) and H_12mo which has 3 system
> missing and 7 user missing (99).
> I want to create a new variable (hosp). I set the new variable to 8 so that
> any cases that "fall thru" will be evident to me. Indeed, 10 cases fall thru
> and are listed as an "8". These are the 3 sysmis and the 7 user missing (99).
> compute hosp=8.
> if H_now EQ 1  hosp = 1.
> if (H_now EQ 0 and H_12mo EQ 1) hosp = 2.
> if (H_now EQ 0 and H_12mo EQ 0) hosp = 3.
> If H_12mo EQ 99  hosp = 98.
> Variable labels hosp 'outcome'.
> Value labels hosp 3 'no event' 2'12 mo event' 1'immediate event'.
> Freq
> /var=hosp
> /missing=include.
[ ... ]
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Compute command and System User missing

David Marso
Administrator
In reply to this post by Rich Ulrich
"
 - If there is a function that tests for MISSING, but not SYSMIS,
you could use that one in place of the present test on 99.
But I don't remember that name, and quick Googling doesn't
show it to me. "

IF (VALUE( H_12mo) EQ  99) hosp=8.

;-)))




Rich Ulrich-2 wrote
You are not totally explicit about what the problem is.
Presumably, "eq 99" does not work because 99 is missing.

One obvious correction is to un-MISS  99 for H_12mo  before the
computation (using MISSING VALUES h_12mo ( ) ); and re-instate
it at the end.  The more direct correction uses the SYSMIS( )
function.

Apparently, you want the value to be 98 if H_12mo was 99,
and 8 if it was SYSMIS.  Thus -- make the initializing of Hosp
set it to 98; and change the test at the end to

IF   SYSMIS(H_12mo)  hosp= 98.

 - If there is a function that tests for MISSING, but not SYSMIS,
you could use that one in place of the present test on 99.
But I don't remember that name, and quick Googling doesn't
show it to me.

--
Rich Ulrich
> Date: Thu, 3 Nov 2011 12:26:12 -0400
> From: [hidden email]
> Subject: Compute command and System User missing
> To: [hidden email]
>
> Hi,
> I'm a doctoral student (epidemiology)and have not used SPSS in awhile. I'm
> trying to do something quite simple but am running into a problem with
> system missing and user missing values.
> Old variables are H_now (no missing values) and H_12mo which has 3 system
> missing and 7 user missing (99).
> I want to create a new variable (hosp). I set the new variable to 8 so that
> any cases that "fall thru" will be evident to me. Indeed, 10 cases fall thru
> and are listed as an "8". These are the 3 sysmis and the 7 user missing (99).
> compute hosp=8.
> if H_now EQ 1  hosp = 1.
> if (H_now EQ 0 and H_12mo EQ 1) hosp = 2.
> if (H_now EQ 0 and H_12mo EQ 0) hosp = 3.
> If H_12mo EQ 99  hosp = 98.
> Variable labels hosp 'outcome'.
> Value labels hosp 3 'no event' 2'12 mo event' 1'immediate event'.
> Freq
> /var=hosp
> /missing=include.
[ ... ]
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Resolved Re: Compute command and System User missing

J McClure
In reply to this post by Rich Ulrich
Thanks! Worked great and I learned from it.
Jan
(John, I used your tutorials a great deal in past and they are
wonderful. Thanks for the count reminder, I forgot about it. I have used
the list function often and I think it was you who suggested that)

On 11/3/2011 11:01 AM, Rich Ulrich wrote:
> IF   SYSMIS(H_12mo)  hosp= $sysmis.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD