Troubleshooting
Problem
I'm using IBM SPSS Statistics and have received some puzzling results when restructuring a file with the CASESTOVARS command (Data->Restructure). The original variables to be restructured are occasionally only copied to a single variable in the new file. This has occurred when there is only one valid value across the records within each unique ID value, and also when there is a combination of one valid value and system-missing. For example, I ran the following commands: data list free / Id rec x y . begin data. 11 1 1 2 11 2 . 3 11 4 . 1 12 1 . 4 12 3 . 4 12 4 2 2 12 5 2 3 13 1 . 2 14 1 . 3 end data. execute. formats rec x y (f4). * I then ran CASESTOVARS to restructure the file. Casestovars id=id /index=rec. list. What I expected to see in the LIST output was: Id x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 11 1 . . . . 2 3 . 1 . 12 . . . 1 . 4 . 4 2 3 13 . . . . . 2 . . . . 14 . . . . . 3 . . . . What was actually printed in the LIST output was: Id x y1 y2 y3 y4 y5 11 1 2 3 . 1 . 12 1 4 . 4 2 3 13 . 2 . . . . 14 . 3 . . . . There is only a single X variable in the restructured file, although Y was restructured into Y1 to Y5, as expected. If I rerun the commands, but first recode sysmis to 0 for X and Y before the CASESTOVARS command, then X is also restructured into X1 to X5. It appears that the combination of a single valid value plus system-missing values within each ID is treated as a within-ID constant by CASESTOVARS. Is this interpretation correct? Is the treatment of system-missing values by CASESTOVARS explained in IBM SPSS Statistics documentation? Is there a workaround to force a variable such as X in this example to be restructured into a set of variables as determined by the value of the record variable?
Log InLog in to view more of this document
Historical Number
86529
Was this topic helpful?
Document Information
Modified date:
16 April 2020
UID
swg21484860