This post was updated on .
CONTENTS DELETED
The author has deleted this message.
|
Administrator
|
What should the final file look like?
If you want all diagXX to be in a single line with mastend as the case I would suggest going from multivariable to single variable (VARSTOCASES) followed by CASESTOVARS. Otherwise you have additional pain. What do you wish to determine from the final restructured data? Better to have an upload of the actual anonymized data than a screenshot.
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?" |
Thanks David,
Agree, my intention was to have all diag in 1 line with mastend as case 1. Will VARSTOCASES AND CASESTOVARS work when you have more than 400,000 records. Point noted. The data is anonymised, but agree supplying a screenshot is not a good idea. I will be linking it to the prescription data. Prasad |
Administrator
|
No problemo!
Consider: input program. + numeric id rec (n6.0). + string diag01 to diag20 (a8). + vector diag=diag01 to diag20. + loop id=1 to 100000. + compute #nrec=trunc(uniform(20)). + loop rec=1 to #nrec. + compute #ndiag=trunc(uniform(20)). + loop #d=1 to #ndiag. + compute #x= trunc(uniform(20)). + compute diag(#d)=string(#x,N5). + end loop. + leave id. + end case. + end loop. + end loop. + end file. end input program. exe. VARSTOCASES /MAKE trans1 FROM diag01 to diag20 /KEEP = id /NULL = DROP. CASESTOVARS /ID = id /GROUPBY = VARIABLE .
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?" |
I am currently out of the office and will return your message upon my return on Monday, October 15th. Thanks. |
In reply to this post by David Marso
Gracias. I will run the syntax and let you know. Cheers Prasad
From: David Marso [via SPSSX Discussion] [ml-node+[hidden email]]
Sent: Friday, 12 October 2012 1:43 PM To: Prasad Nishtala Subject: RE: restructuring-many records into one No problemo!
Consider: input program. + numeric id rec (n6.0). + string diag01 to diag20 (a8). + vector diag=diag01 to diag20. + loop id=1 to 100000. + compute #nrec=trunc(uniform(20)). + loop rec=1 to #nrec. + compute #ndiag=trunc(uniform(20)). + loop #d=1 to #ndiag. + compute #x= trunc(uniform(20)). + compute diag(#d)=string(#x,N5). + end loop. + leave id. + end case. + end loop. + end loop. + end file. end input program. exe. VARSTOCASES /MAKE trans1 FROM diag01 to diag20 /KEEP = id /NULL = DROP. CASESTOVARS /ID = id /GROUPBY = VARIABLE .
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/RE-restructuring-many-records-into-one-tp5715607p5715612.html
|
In reply to this post by David Marso
From: David Marso [via SPSSX Discussion] [ml-node+[hidden email]]
Sent: Friday, 12 October 2012 1:43 PM To: Prasad Nishtala Subject: RE: restructuring-many records into one No problemo!
Consider: input program. + numeric id rec (n6.0). + string diag01 to diag20 (a8). + vector diag=diag01 to diag20. + loop id=1 to 100000. + compute #nrec=trunc(uniform(20)). + loop rec=1 to #nrec. + compute #ndiag=trunc(uniform(20)). + loop #d=1 to #ndiag. + compute #x= trunc(uniform(20)). + compute diag(#d)=string(#x,N5). + end loop. + leave id. + end case. + end loop. + end loop. + end file. end input program. exe. VARSTOCASES /MAKE trans1 FROM diag01 to diag20 /KEEP = id /NULL = DROP. CASESTOVARS /ID = id /GROUPBY = VARIABLE .
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/RE-restructuring-many-records-into-one-tp5715607p5715612.html
|
Free forum by Nabble | Edit this page |