VarsToCases and CasesToVars
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | * RESTRUCTURE WIZARD (Version 12+). *************. EXAMPLE #1: *************. Q: I have a database where there are separate lines/cases, each for a different observation time. How do I convert this to a useable file? Is it possible to do the old SPSS format statement and read the separate lines in, naming each variable something that represents the observation time (like ID1, ID2, etc.)? A: The Restructure Wizard helps you to "restructure" your data from multiple variables (columns) in a single case to groups of related cases(rows). Below is a program (Under Data...Restructure) to accomplish the task without lots of complicated programming. DATA LIST /ID 2 TIME 5-11 (A) SCORE 13-14. begin data. 1 before 73 1 during 77 1 after 84 2 before 58 2 after 95 3 before 68 3 during 70 3 after 75 end data. LIST. SORT CASES BY ID TIME . CASESTOVARS /ID = ID /INDEX = TIME /GROUPBY = VARIABLE . *Change the order of the file. MATCH FILES FILE=* /KEEP=id before during after. EXECUTE. *************. *EXAMPLE #2: *************. Q: I have a database where information for one person or organization is stored in one record. I want to create separate lines for analysis purposes. I have hired a programmer to do this, but it's taking a long time. Can SPSS do that? A: The Restructure Wizard helps you to "restructure" your data from from single-line records to multiple line records. This file can then be used to Aggregate statistics. DATA LIST /ID 2 GROUP 4 Grade1 6-7 Grade2 9-10 Grade3 12-13 Grade4 15-17. BEGIN DATA. 1 1 11 13 15 18 2 1 12 18 16 25 3 2 11 13 13 14 4 2 18 20 . 29 5 3 13 13 13 18 6 3 9 15 21 35 END DATA. LIST. VARSTOCASES /ID = id1 /MAKE SCORES FROM Grade1 Grade2 Grade3 Grade4 /INDEX = Index(4) /KEEP = GROUP /NULL = KEEP /COUNT = NUMRECORDS. |
Related pages
...