Dear All,
i'm having a series of 21 products each product is being evaluated using 10 different parameters (210 columns) on a scale of 1-99 each data record (row) is having responses for only 1 product out of the 21 and the rest would be blank what i need to do is to move all the products from the 210 columns to only one group of 10 columns as i'm having an indicator to know which product is being used for each respondent. i tried compute and recode but it didn't work can somebody please help me with that Thanks in advance Mohd |
Administrator
|
Does this get you close? VARSTOCASES /ID=id /MAKE score FROM prod1param1 to prod21param10 /INDEX=product(21) parameter(10) /NULL=DROP.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by Mohammed Mustafa
Can you cobble together an example, say, with 3 products and 3 parameters that looks like your input data as it is? Then show what you want it to look like? Art Kendall Social Research Consultants On 1/4/2011 5:12 AM, Mohammed Mustafa wrote: Dear All,===================== 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
Art Kendall
Social Research Consultants |
In reply to this post by Mohammed Mustafa
Assuming your data looks something like this: Product p1_s1… p1_s10 p2_s1…p2_s10 ………
p21_s1…p21_s10 1 scores
for prod.1 empty empty 2 empty scores
for prod.2 empty … 21 empty empty scores
for prod.21 How about the following: DO REPEAT var1=p1_s1 to p1_s10 /var2=p2_s1 to p2_s10 /….
/var21=p21_s1 to p21_s10 /newvar=s1 to s10. COMPUTE newvar=max(var1,var2,var3,….,var21). END REPEAT. The variables s1 to s10 will all be full, each of the scores
corresponding to “product”. Hope this helps. Nirit From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Mohammed Mustafa Dear
All, |
Administrator
|
In reply to this post by Mohammed Mustafa
I leave it to you to study and generalize the following:
Also, in the future it would be helpful to post what you "tried but didn't work" . HTH, David data list free / ID x1_p1 TO x1_p4 X2_p1 To X2_p4 x3_p1 TO X3_p4. begin data 01 11 12 13 14 . . . . . . . . 02 . . . . 21 22 23 24 . . . . 03 . . . . . . . . 31 32 33 34 end data. VECTOR XP=X1_P1 TO X3_P4 /KEEP(4). LOOP X=1 TO 3. + LOOP P=1 TO 4. + DO IF NOT MISSING ( XP((X-1)*4+P)) . + COMPUTE KEEP(P)= XP((X-1)*4+P) . + COMPUTE INDIC=X. + END IF. + END LOOP. END LOOP. XSAVE OUTFILE "TEMP" / KEEP ID INDIC KEEP1 TO KEEP4. EXE. GET FILE "TEMP" . list. ID INDIC KEEP1 KEEP2 KEEP3 KEEP4 1.00 1.00 11.00 12.00 13.00 14.00 2.00 2.00 21.00 22.00 23.00 24.00 3.00 3.00 31.00 32.00 33.00 34.00 Number of cases read: 3 Number of cases listed: 3
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Administrator
|
Ah, okay. If that is the desired result, my VARSTOCASES method was incomplete. One would have to add a CASESTOVARS, like this:
data list free / ID x1_p1 TO x1_p4 X2_p1 To X2_p4 x3_p1 TO X3_p4. begin data 01 11 12 13 14 . . . . . . . . 02 . . . . 21 22 23 24 . . . . 03 . . . . . . . . 31 32 33 34 04 . . . . 21 22 23 24 . . . . 05 11 12 13 14 . . . . . . . . end data. VARSTOCASES /MAKE parameter FROM x1_p1 to x3_p4 /INDEX=product(3) parameter_number(4) /NULL=DROP. CASESTOVARS /ID=ID product /INDEX=parameter_number /GROUPBY=VARIABLE. RESULT: ID product parameter.1 parameter.2 parameter.3 parameter.4 1 1 11 12 13 14 2 2 21 22 23 24 3 3 31 32 33 34 4 2 21 22 23 24 5 1 11 12 13 14
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Free forum by Nabble | Edit this page |