|
I am using SPSS v 16 and have a data set of mutiple individual evaluations.
I would like to aggregate multiple individual records into one longtidunal record for each case (example below). I'm looking for syntax assistance that might help me not only move the data into a single record but also rename the individual items by version of the evaluation and add new variable of Eval_number. Thanks, Gregg Current: Case_Id....eval_Date...eval_type...Item 1 - item 105 1 3/6/08 1 1 2 1 4/6/08 2 2 3 2 4/6/09 2 1 1 2 5/6/09 3 1 1 want: Case_Id. eval_Date_1...eval_type_1...Item 1.1 - item 105.1; eval_date_2 Eval_type_2 Eval_Number Item 1.2 - item_105.2....... 1 3/6/08 1 1 2 4/6/08 2 2 3 2 4/6/09 2 1 1 5/6/09 3 1 1 ===================== 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 |
|
Hi Gregg,
You want to restructure your data from tall to wide. To do this, click Data>Restructure. You want the second option, to "Restructure selected cases into variables". Move CaseID into the Identifier Variable/s and click Next. Click Yes when asked whether you want to sort the data. For Order of New Variables, click Group by Original Variable and click next. Then click Paste to get the syntax below... SORT CASES BY CaseID . CASESTOVARS /ID=CaseID /GROUPBY=INDEX. Hope that helps. -Ari On Wed, May 6, 2009 at 6:24 AM, Gregg Defrancesco <[hidden email]> wrote: I am using SPSS v 16 and have a data set of mutiple individual evaluations. |
|
In reply to this post by Gregg Defrancesco
Ari,
Thanks, I ran the Restructure with the syntax. Of course I've run into a
new problem. The data is now in a "wide" format but in an order that is not
logically sequenced. For example:
Case Id...Eval_Type 1 - Eval_Type 20...Eval_Date 1 - Eval_Date 20....Item
1.1 - Item 1.20...Item 105.1 - Item 105.20
How would I run the restructure to have the output in a logical sequence of
evaluation date, type & then items. Like:
Case Id...Eval 1...Eval_Type 1...Eval_Date 1...Item 1.1 - 105.1...Eval_Type
2...Eval_Date 2.. Item 1.2 - 105.2
If I created a new Variable 'eval_number' and then within the restructure
command used that as an index variable would that produce the above results.
Thank you for your assistance, it is very much appreciated.
Gregg
|
|
In reply to this post by Gregg Defrancesco
At 07:24 AM 5/6/2009, Gregg Defrancesco wrote:
I have a data set of multiple individual evaluations:|-----------------------------|---------------------------| |Output Created |07-MAY-2009 10:08:09 | |-----------------------------|---------------------------| Case_Id eval_Date eval_type Item_1 Item_2 Item_105 1 03/06/08 1 1 5 2 1 04/06/08 2 2 6 3 2 04/06/09 2 1 7 1 2 05/06/09 3 1 8 1 Number of cases read: 4 Number of cases listed: 4 I would like to aggregate multiple individual records into one longitudinal record for each case (example below), to move the data into a single record and also rename the individual items by version of the evaluation and add new variable of Eval_number: First, of course: Do you really want to? For most analyses and computations, SPSS works better with the 'long' organization you're starting with. What analyses or computations will you be doing, on the new dataset? However, as Ariel Barak wrote, what you want should need only a straightforward CASESTOVARS. Below is an illustration that seems to give it (but it's almost identical to Ariel Barak's, which you say didn't do it). I'm not sure what you want "Eval_Number" to be: The number of evaluations for the case? If it's to be a sequence number for evaluations, it would have to be one variable for each evaluation, suffixed Eval_Number.1, Eval_Number.2, etc. I'm making it a single variable, giving the number of evaluations for the case. Anyway, CASESTOVARS /ID = Case_Id /GROUPBY = INDEX /COUNT = Eval_number . Cases to Variables |-----------------------------|---------------------------| |Output Created |08-MAY-2009 20:06:57 | |-----------------------------|---------------------------| Generated Variables |-----------|-----------| |Original |Result | |Variable |-----------| | |Name | |---------|-|-----------| |eval_Date|1|eval_Date.1| | |2|eval_Date.2| |---------|-|-----------| |eval_type|1|eval_type.1| | |2|eval_type.2| |---------|-|-----------| |Item_1 |1|Item_1.1 | | |2|Item_1.2 | |---------|-|-----------| |Item_2 |1|Item_2.1 | | |2|Item_2.2 | |---------|-|-----------| |Item_105 |1|Item_105.1 | | |2|Item_105.2 | |---------|-|-----------| Processing Statistics |---------------|---| |Cases In |4 | |Cases Out |2 | |---------------|---| |Cases In/Cases |2.0| |Out | | |---------------|---| |Variables In |6 | |Variables Out |12 | |---------------|---| |Index Values |2 | |---------------|---| LIST. List |-----------------------------|---------------------------| |Output Created |08-MAY-2009 20:06:57 | |-----------------------------|---------------------------| Case Eval_n eval_Dat eval_t Item Item Item_ eval_Dat eval_t Item Item _Id umber e.1 ype.1 _1.1 _2.1 105.1 e.2 ype.2 _1.2 _2.2 Item_105.2 1 2 03/06/08 1 1 5 2 04/06/08 2 2 6 3 2 2 04/06/09 2 1 7 1 05/06/09 3 1 8 1 Number of cases read: 2 Number of cases listed: 2 ============================= APPENDIX: Test data, and code ============================= DATA LIST LIST/ Case_Id eval_Date eval_type Item_1 Item_2 Item_105 (F2, ADATE8, F2, F2, F2, F2). BEGIN DATA 1 3/6/08 1 1 5 2 1 4/6/08 2 2 6 3 2 4/6/09 2 1 7 1 2 5/6/09 3 1 8 1 END DATA. LIST. CASESTOVARS /ID = Case_Id /GROUPBY = INDEX /COUNT = Eval_number . LIST. ===================== 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 |
|
In reply to this post by Gregg Defrancesco
First thanks to you both for your input on my problem. This second
variation on the CASESTOVARS syntax worked! In answer to your first
question, I will be computing Mean Change Scores, and doing Growth Curve
Trajectories & Survival Analysis. This is just one of the data set files
that I will eventually be merging for my Doctoral Dissertation. I also have to
design a code book. I thought that the merging and code book would be easier
with everything in this format?
Thanks again to you both,
Gregg
In a message dated 5/10/2009 4:23:14 P.M. Eastern Daylight Time,
[hidden email] writes:
At 07:24 AM 5/6/2009, Gregg Defrancesco wrote: |
|
At 05:42 AM 5/15/2009, Gregg Defrancesco wrote:
>First thanks to you both for your input on my problem. This second >variation on the CASESTOVARS syntax worked! Excellent! I'm glad. >At 5/10/2009 at 4:23:14 P.M. Eastern Daylight Time, Richard Ristow asked: > >>>I would like to aggregate multiple individual records into one >>>longitudinal record for each case >> >>Do you really want to? For most analyses and computations, SPSS >>works better with the 'long' organization you're starting with. >I will be computing Mean Change Scores, and doing Growth Curve >Trajectories & Survival Analysis. This is just one of the data set >files that I will eventually be merging for my Doctoral >Dissertation. I also have to design a code book. I thought that the >merging and code book would be easier with everything in this format? I'd think all of these would be easier with the data in its original form. For example, wouldn't a code book with 105 entries be easier, than one with 105*<whatever> entries? For survival analysis, you'll probably want one record per subject, but it's probably easier to get the data in that form as needed, retaining only the data needed for the analysis, and probably using AGGREGATE rather than CASESTOVARS. -Best of luck and best wishes, Richard ===================== 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 |
| Free forum by Nabble | Edit this page |
