Is this what you have? 3 variables,
id a b 1 1 101 2 2 102 3 3 103 4 4 104 5 0 105 6 0 106 and you want to go from a "wide" to "long" layout like this with 2 variables id and c? 1 1 2 2 3 3 4 4 5 0 6 0 1 101 2 102 3 103 4 104 5 105 6 106 If this is what you want and it is just an excise and you do not need an audit trail just select cut and paste in the data view even in excel you could just select copy and paste why would you need a loop? Art Kendall Social Research Consultants On 1/28/2012 1:38 PM, Johanna Muñoz wrote: The thing is i have two variables a an b... a with id from 1 to na and b with id from 1 to nb, not big deal,,,if we traduce that in terms of excel would be,, i have a variable "A" that goes from A1:A100 and a variable "B" that goes from B1:B133 i only need to create a new variable "C" that is equal to copy paste "A" in column "C" and then in the cells C100 copy and paste the other variable "B" in order to get a variable "C" that goes from C1:C233. In excel is easy to do that with a loop,, but in SPSS i dont have any idea..===================== 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 |
Are you basically trying to change variables to
cases as in the example I posted? I.e., considering a and be to
ranges (sets) of variable?
Are you trying to do something like this? a1 to a5 is a set of measures on cases with IDs. (e.g., age sex IQ height weight)as guessed by 1 person For the same cases you have another set of the same measures (age sex IQ height weight)as guessed by another person. Some guesses were made by only one person not both. If you describe your data more explicitly members of the list may be able to suggest ways to achieve what you want. of the several things I think you might mean, none would need any LOOP statements. Art Kendall Social Research Consultants On 1/28/2012 4:42 PM, Johanna Muñoz wrote: Hi because i have to move a lot of information in that way,, is not only one variable,, for that reason i would like to know how to do it with loops. :)===================== 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 |
Administrator
|
In reply to this post by Art Kendall
data list free / id a b.
begin data 1 2 3 2 3 4 3 4 5 end data, XSAVE OUTFILE 'tempcopy.sav'. exe. add files / file * / FILE 'tempcopy.sav' / IN=flag. COMPUTE C=A. IF FLAG C=B. list.
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?" |
Free forum by Nabble | Edit this page |