Date: Fri, 10 Sep 2010 16:27:23 -0700
Reply-To: J McClure <mc006@pacbell.net>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: J McClure <mc006@pacbell.net>
Subject: Re: change multiple category format to multiple dichotomy format
In-Reply-To: <97D6F0A82A6E894DAF44B9F575305CC90F05844D@HCAMAIL03.ochca.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Thanks Matthew!
I got the following error message when I tried to run the code. I don't
understand 'do repeat' very well so I'm not sure what the error is. Jan
>Error # 4516 in column 22. Text: psde.6
>The form VARX TO VARY to refer to a range of variables has been used
>incorrectly. It cannot be used when one of VARX or VARY is defined
and the
>other is not.
>Execution of this command stops.
On 9/10/2010 3:10 PM, Pirritano, Matthew wrote:
> I think this should work. Untested. This will create 6 new variables per
> original PLPsy variable.
>
> numeric none.1 to none.6(f2).
> numeric mood.1 to mood.6(f2).
> numeric ptsd.1 to ptsd.6(f2).
> numeric anxiety.1 to anxiety.6(f2).
> numeric schiz.1 to schiz.6(f2).
> numeric pd.1 to pd.6(f2).
> numeric other.1 to other.6(f2).
> numeric sud.1 to sud.6(f2).
>
> do repeat pl = PLPsy1 to PLPsy6
> /none = none.1 to none.6
> /mood = mood.1 to mood.6
> /ptsd = ptsd.1 to psde.6
> /anxiety = anxiety.1 to anxiety.6
> /schiz = schiz.1 to schiz.6
> /pd = pd.1 to pd.6
> /other = other.1 to other.6
> /sud = sud.1. to sud.6.
>
> recode pl (0 = 1)(else = 0) into none.
> recode pl (1 = 1)(else = 0) into mood.
> recode pl (2 = 1)(else = 0) into ptsd.
> recode pl (3 = 1)(else = 0) into anxiety.
> recode pl (4 = 1)(else = 0) into schiz.
> recode pl (5 = 1)(else = 0) into pd.
> recode pl (6 = 1)(else = 0) into other.
> recode pl (7 = 1)(else = 0) into sud.
> end repeat.
> exe.
>
>
> Matthew Pirritano, Ph.D.
> Research Analyst IV
> Medical Services Initiative (MSI)
> Orange County Health Care Agency
> (714) 568-5648
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
> J McClure
> Sent: Friday, September 10, 2010 2:41 PM
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: change multiple category format to multiple dichotomy format
>
> Hi,
> I have multiple response data in the form of multiple categories.
> Specifically, I have 6 variables (PLPsy1,PLPsy2, PLPsy3, PLPsy4,
> PLPsy5, PLPsy6).
> For each variables there are 8 possible values (0 thru 7) which
> represent none, Mood, PTSD, Anxiety, Schiz, PD, other, and SUD,
> I want to transform the data to the multiple dichotomies format such
> that I would have 8 dichotomous (0,1) variables called none, Mood,
> PTSD, Anxiety, Schiz, PD, other, and SUD.
>
> Here is a sample of my data in the current format
>
> DATA LIST LIST /id PLPsy1 PLPsy2 PLPsy3 PLPsy4, PLPsy5, PLPsy6.
> BEGIN DATA.
> 2 1 2 6 6 0 0
> 3 7 0 0 0 0 0
> 7 0 0 0 0 0 0
> 24 1 5 6 0 0 0
> 26 1 2 6 6 0 0
> 27 7 7 0 0 0 0
> 28 1 6 6 0 0 0
> 29 6 6 0 0 0 0
> 30 0 0 0 0 0 0
> 31 5 0 0 0 0 0
> END DATA.
> LIST.
>
> I want to end up with
> ID none Mood PTSD Anxiety Schiz PD other SUD
> 2 0 1 1 0 0 0 1 0
> 3 0 0 0 0 0 0 0 1
> 7 1 0 0 0 0 0 0 0
>
> Thanks,
> Jan
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (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
> LISTSERV@LISTSERV.UGA.EDU (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
LISTSERV@LISTSERV.UGA.EDU (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
|