Help creating a one dichtomos variable out of 25 variables

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

Help creating a one dichtomos variable out of 25 variables

biosludge
Need Some Help,

Ok, here is my situation. I have a data set with over 4 million entries. Each entry is a patient. Each patient has 25 potential diagnoses. I want to create one new variable that combines all the 25 variable into a dichotomous variable that looks for the presence of one code. If that code is present then it will be a 1 and if it is absent then it will be a 0.

For example, 60,000 cases are positive for the health outcome that I am interested in. However, I want one variable that says that the patient was either diagnosed for a specific health outcome or not. Then I want to export those 60,000 cases and their data to a new PASW sheet to make it easier to manipulate.

I am using PASW ver 18 for the mac.

Thanks,

Jared
Reply | Threaded
Open this post in threaded view
|

Re: Help creating a one dichtomos variable out of 25 variables

Bruce Weaver
Administrator
biosludge wrote
Need Some Help,

Ok, here is my situation. I have a data set with over 4 million entries. Each entry is a patient. Each patient has 25 potential diagnoses. I want to create one new variable that combines all the 25 variable into a dichotomous variable that looks for the presence of one code. If that code is present then it will be a 1 and if it is absent then it will be a 0.

For example, 60,000 cases are positive for the health outcome that I am interested in. However, I want one variable that says that the patient was either diagnosed for a specific health outcome or not. Then I want to export those 60,000 cases and their data to a new PASW sheet to make it easier to manipulate.

I am using PASW ver 18 for the mac.

Thanks,

Jared
Use the ANY function in a compute statement.  Here's some info from the Help files.

ANY. ANY(test,value[,value,...]). Logical. Returns 1 or true if the value of test matches any of the subsequent values; returns 0 or false otherwise. This function requires two or more arguments. For example, ANY(var1, 1, 3, 5) returns 1 if the value of var1 is 1, 3, or 5 and 0 for other values. ANY can also be used to scan a list of variables or expressions for a value. For example, ANY(1, var1, var2, var3) returns 1 if any of the three specified variables has a value of 1 and 0 if all three variables have values other than 1.

You haven't said what types of variables the 25 diagnosis variables are.  If they are numeric where 1 = Yes, then:

compute dxflag = ANY(1,dx1 to dx25).

Or if they are string variables:

compute dxflag = ANY("diagnosis you want",dx1 to dx25).

--
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: Help creating a one dichtomos variable out of 25 variables

Jerabek Jindrich
In reply to this post by biosludge
Jared,

*this creates new variable coded 1 if your code is present in any of the 25 possible vars.
COMPUTE NewVar=0.
IF any (CodeOfInterest, Diagnosis1 to Diagnosis25) NewVar = 1.

*Select pacients with the diagnosis and save for later use.
SELECt if NewVar eq 1.
SAVE outfile =  .....

regards
jindra

> ------------ Původní zpráva ------------
> Od: biosludge <[hidden email]>
> Předmět: Help creating a one dichtomos variable out of 25 variables
> Datum: 19.1.2010 04:44:01
> ----------------------------------------
> Need Some Help,
>
> Ok, here is my situation. I have a data set with over 4 million entries.
> Each entry is a patient. Each patient has 25 potential diagnoses. I want to
> create one new variable that combines all the 25 variable into a dichotomous
> variable that looks for the presence of one code. If that code is present
> then it will be a 1 and if it is absent then it will be a 0.
>
> For example, 60,000 cases are positive for the health outcome that I am
> interested in. However, I want one variable that says that the patient was
> either diagnosed for a specific health outcome or not. Then I want to export
> those 60,000 cases and their data to a new PASW sheet to make it easier to
> manipulate.
>
> I am using PASW ver 18 for the mac.
>
> Thanks,
>
> Jared
>
> --
> View this message in context:
> http://old.nabble.com/Help-creating-a-one-dichtomos-variable-out-of-25-variables-tp27201524p27201524.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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