How to do many if then

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

How to do many if then

msherman
Dear list:  I just imported an data file from SurveyMonkey. The Data
file is consists of 300 participants that respondent to 8 scales. The 8
scales were randomized within SurveyMonkey. I now have something like
this. The first 100 variables (sequence 1) has 30 participants, the next
100 variables (sequence 2) has another 30 participants, and the next 100
variables (sequence 3) has another 30 particpant,  etc. All in all I
have 12 different sequences. The variables have slightly different
variable names from one sequence to another. I now need to bring
together all of the variables that go together. For instance I have a
Subjective Well being scale where I have SWB1_1 to SWB1_5,  SWB2_1 to
SWB2_5, SWB3_1 to SWB3_5, SWB4_1 to SWB4_5,etc  SWB12_1 to SWB12_5.
There is a long and tedious way of bringing all of the variables
together so that in the end there is only one set of variables for the
Subjective Well Being Scale[SWB1, SWB2, SWB3, SWB4, SWB5). Does any one
have a syntax file that I could modify for my purposes. Thank you very
much.   martin sherman
Reply | Threaded
Open this post in threaded view
|

Re: How to do many if then

statisticsdoc
Martin,

How about using a bunch of DO REPEAT statements.  The order of the variables
for VARA reflects changes in the way that the variables were presented - I
made up changes in the order.  Subjects get scores if there are ratings
greater than or equal to one on the relevant items (assuming that 1 is the
minimum valid value).  At the end of all 12 do repeat statements, some
subjects will have missing data.

** Untested.

DO REPEAT  VARA = SWB1_1 SWB1_2 SWB1_3 SWB1_4 SWB1_5
 / VARB = SWB1 SWB2 SWB3 SWB4 SWB5 .
IF (VARA GE 1) VARB = VARA .
END REPEAT .

DO REPEAT  VARA = SWB2_2 SWB2_3 SWB2_1 SWB2_5 SWB2_4
 / VARB = SWB1 SWB2 SWB3 SWB4 SWB5 .
IF (VARA GE 1) VARB = VARA .
END REPEAT .

..... and so on and so forth .....

DO REPEAT  VARA = SWB12_5 SWB12_3 SWB12_1 SWB12_3 SWB12_4
 / VARB = SWB1 SWB2 SWB3 SWB4 SWB5 .
IF (VARA GE 1) VARB = VARA .
END REPEAT .

There may be a more elegant way, but this should get the job done.

HTH,

Stephen Brand



For personalized and professional consultation in statistics and research
design, visit
www.statisticsdoc.com


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of
Martin Sherman
Sent: Tuesday, January 09, 2007 5:20 PM
To: [hidden email]
Subject: How to do many if then


Dear list:  I just imported an data file from SurveyMonkey. The Data
file is consists of 300 participants that respondent to 8 scales. The 8
scales were randomized within SurveyMonkey. I now have something like
this. The first 100 variables (sequence 1) has 30 participants, the next
100 variables (sequence 2) has another 30 participants, and the next 100
variables (sequence 3) has another 30 particpant,  etc. All in all I
have 12 different sequences. The variables have slightly different
variable names from one sequence to another. I now need to bring
together all of the variables that go together. For instance I have a
Subjective Well being scale where I have SWB1_1 to SWB1_5,  SWB2_1 to
SWB2_5, SWB3_1 to SWB3_5, SWB4_1 to SWB4_5,etc  SWB12_1 to SWB12_5.
There is a long and tedious way of bringing all of the variables
together so that in the end there is only one set of variables for the
Subjective Well Being Scale[SWB1, SWB2, SWB3, SWB4, SWB5). Does any one
have a syntax file that I could modify for my purposes. Thank you very
much.   martin sherman