|
Hello, Have someone a syntax which would help me to rotate a
database in SPSS? My database show like this: Respondent1 Product A Evaluation for prod A Product
B Evaluation for product B ………………………
(all the
possible combinations, all the products are shown at exactly same number of
times) Respondent2 Product B Evaluation for prod B Product
A Evaluation for product A ………………………. Respondent3 Product C Evaluation for prod C
Product A Evaluation for product A…………………………. Respondent4 Product C Evaluation for prod C
Product C Evaluation for product C………………………… Respondent5 Product D Evaluation for prod D Product
D Evaluation for product D………………………… Respondent6 Product A Evaluation for prod A Product
B Evaluation for product B…………………………. And I need my database to look like: Respondent1 Product A Evaluation for prod A Product
B Evaluation for product B ……………………… (I want
to create specific columns for each attribute) Respondent2 Product A Evaluation for prod A Product
B Evaluation for product B ………………………. Respondent3 Product A Evaluation for prod A Product
B Evaluation for product B…………………………. Respondent4 Product A Evaluation for prod A Product
B Evaluation for product B………………………… Respondent5 Product A Evaluation for prod A Product
B Evaluation for product B………………………… Respondent6 Product A Evaluation for prod A Product
B Evaluation for product B…………………………. Thank you very much, Alexandra |
|
At 02:36 AM 8/3/2010, Alexandra Chirilov wrote:
Have someone a syntax which would help me to rotate a database in SPSS? Or, shortening the values and reading the data as SPSS variables (and correcting Respondent4s 4 and 5, each of whom had the same product entered more than once): |-----------------------------|---------------------------| |Output Created |08-AUG-2010 20:34:59 | |-----------------------------|---------------------------| Respondent Prod01 Eval01 Prod02 Eval02 Respondent1 Prod_A Eval A Prod_B Eval_B Respondent2 Prod_B Eval_B Prod_A Eval_A Respondent3 Prod_C Eval_C Prod_A Eval_A Respondent4 Prod_C Eval_C Prod_X Eval_X Respondent5 Prod_D Eval_D Prod_X Eval_X Respondent6 Prod_A Eval_A Prod_B Eval_B Number of cases read: 6 Number of cases listed: 6 And I need my database to look like: I'd do this with VARSTOCASES, SORT, CASESTOVARS. I've omitted the columns with "Product A", "Product B", etc., because the values in those columns can never vary within the data, except between product name and blank. Code is tested. VARSTOCASES /MAKE Prod FROM Prod01 Prod02 /MAKE Eval FROM Eval01 Eval02 /KEEP = Respondent /NULL = KEEP. Variables to Cases |-----------------------------|---------------------------| |Output Created |08-AUG-2010 20:35:00 | |-----------------------------|---------------------------| Generated Variables |----|------| |Name|Label | |----|------| |Prod|<none>| |Eval|<none>| |----|------| Processing Statistics |-------------|-| |Variables In |5| |Variables Out|3| |-------------|-| SORT CASES BY Respondent Prod. CASESTOVARS /ID = Respondent /INDEX = Prod /GROUPBY = INDEX . Cases to Variables |-----------------------------|---------------------------| |Output Created |08-AUG-2010 20:35:00 | |-----------------------------|---------------------------| Generated Variables |--------|------|------| |Original|Prod |Result| |Variable| |------| | | |Name | |--------|------|------| |Eval |Prod_A|Prod_A| | |Prod_B|Prod_B| | |Prod_C|Prod_C| | |Prod_D|Prod_D| | |Prod_X|Prod_X| |--------|------|------| Processing Statistics |---------------|---| |Cases In |12 | |Cases Out |6 | |---------------|---| |Cases In/Cases |2.0| |Out | | |---------------|---| |Variables In |3 | |Variables Out |6 | |---------------|---| |Index Values |5 | |---------------|---| LIST. List |-----------------------------|---------------------------| |Output Created |08-AUG-2010 20:35:00 | |-----------------------------|---------------------------| Respondent Prod_A Prod_B Prod_C Prod_D Prod_X Respondent1 Eval A Eval_B Respondent2 Eval_A Eval_B Respondent3 Eval_A Eval_C Respondent4 Eval_C Eval_X Respondent5 Eval_D Eval_X Respondent6 Eval_A Eval_B Number of cases read: 6 Number of cases listed: 6 ============================= APPENDIX: Test data, and code ============================= DATA LIST FIXED/ Respondent 01-11 (A) Prod01 14-19 (A) Eval01 26-31 (A) Prod02 38-43 (A) Eval02 48-53 (A). *---|---10----|---20----|---30----|---40----|---50----|---60. BEGIN DATA Respondent1 Prod_A Eval A Prod_B Eval_B Respondent2 Prod_B Eval_B Prod_A Eval_A Respondent3 Prod_C Eval_C Prod_A Eval_A Respondent4 Prod_C Eval_C Prod_X Eval_X Respondent5 Prod_D Eval_D Prod_X Eval_X Respondent6 Prod_A Eval_A Prod_B Eval_B END DATA. LIST. VARSTOCASES /MAKE Prod FROM Prod01 Prod02 /MAKE Eval FROM Eval01 Eval02 /KEEP = Respondent /NULL = KEEP. LIST. SORT CASES BY Respondent Prod. CASESTOVARS /ID = Respondent /INDEX = Prod /GROUPBY = INDEX . 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 |
| Free forum by Nabble | Edit this page |
