Within Variable Calculations and SELECT IF help

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

Within Variable Calculations and SELECT IF help

Justin Blehar
Hello All,

I'm working with a data-set that has repeated measures overtime but each measure is listed under the same variable. Here is an example of what I have:

ID        Test_1_Date      Test_1_Score      Test_2_Date     Test_2_Score     Test_3_Date     Test_3_Score
123        11/12/08            43                    10/15/08            21                        10/15/08        54
123        09/15/11            36                    08/12/11            14                        08/12/11        42
456        09/15/07            52                    07/12/07            25                        07/13/07        34
456        10/21/10            62                    09/12/10            31                        09/12/10        40

My goal is to examine the difference scores between each individual overtime. I would like to have a dataset that looks like this so I can start my analysis:

ID        Test_1_Date      Test_1_Date@    Test_1_Score    Test_1_Score@     Test_2_Date     Test_2_Date@    Test_2_Score     Test_2_Score@    Test_3_Date     Test_3_Date@    Test_3_Score    Test_3_Score@
123        11/12/08           09/15/11             43                     36                       10/15/08          08/12/11               21                     14                   10/15/08            08/12/11                54                42
456        09/15/07          10/21/10              52                     62                        07/12/07         09/12/10               25                      31                  07/13/07            09/12/10                34                40


I've looked through the archives and tried putting together some syntax and am not having much luck. I'm thinking that a SELECT IF command would be my best bet. If I could select the first set of cases and create a new data set then select the second case and create another dataset I could merge the datasets and get what I'm looking for. I don't know how to select one case when the ID's are identical. I plan on doing the following:

Manually change each ID:
123
123A
456
456A
etc...
SELECT IF (Is there a way I can select any case with an A in a string variable regardless of the numbers?)
Create a new outfile with the selected data
SELECT IF (This time I'd want to select any case without an A in a string variable if possible?)
Create another new outfile with these data
MERGE the datasets.

 As always your input is greatly appreciated!

Hope I covered my bases in regards to posting and feel free to beat me up if I didn't :)

V/R

Justin Blehar
Aspiring SPSS user


Reply | Threaded
Open this post in threaded view
|

Re: Within Variable Calculations and SELECT IF help

Maguin, Eugene

One command: Casestovars. Gene Maguin

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Justin Blehar
Sent: Monday, January 28, 2013 12:37 PM
To: [hidden email]
Subject: Within Variable Calculations and SELECT IF help

 

Hello All,

I'm working with a data-set that has repeated measures overtime but each measure is listed under the same variable. Here is an example of what I have:

ID        Test_1_Date      Test_1_Score      Test_2_Date     Test_2_Score     Test_3_Date     Test_3_Score
123        11/12/08            43                    10/15/08            21                        10/15/08        54
123        09/15/11            36                    08/12/11            14                        08/12/11        42
456        09/15/07            52                    07/12/07            25                        07/13/07        34
456        10/21/10            62                    09/12/10            31                        09/12/10        40

My goal is to examine the difference scores between each individual overtime. I would like to have a dataset that looks like this so I can start my analysis:

ID        Test_1_Date      Test_1_Date@    Test_1_Score    Test_1_Score@     Test_2_Date     Test_2_Date@    Test_2_Score     Test_2_Score@    Test_3_Date     Test_3_Date@    Test_3_Score    Test_3_Score@
123        11/12/08           09/15/11             43                     36                       10/15/08          08/12/11               21                     14                   10/15/08            08/12/11                54                42
456        09/15/07          10/21/10              52                     62                        07/12/07         09/12/10               25                      31                  07/13/07            09/12/10                34                40


I've looked through the archives and tried putting together some syntax and am not having much luck. I'm thinking that a SELECT IF command would be my best bet. If I could select the first set of cases and create a new data set then select the second case and create another dataset I could merge the datasets and get what I'm looking for. I don't know how to select one case when the ID's are identical. I plan on doing the following:

Manually change each ID:
123
123A
456
456A
etc...
SELECT IF (Is there a way I can select any case with an A in a string variable regardless of the numbers?)
Create a new outfile with the selected data
SELECT IF (This time I'd want to select any case without an A in a string variable if possible?)
Create another new outfile with these data
MERGE the datasets.

 As always your input is greatly appreciated!

Hope I covered my bases in regards to posting and feel free to beat me up if I didn't :)

V/R

Justin Blehar
Aspiring SPSS user