|
Dear all
I have a typical database, starting with an ID followed by variables in column and individuals in rows: ID VAR1 VAR2... 1 2 3 4 5 etc. I would like to add rows, say 4, between each pre-existing row, to get something like this: ID VAR1 VAR2... 1 . . . . 2 . . . . 3 . . . . etc. Any suggestion? Thanks for your inspiration Eric ===================== 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 |
|
At 04:57 PM 11/26/2007, Eric Janssen wrote:
>I have a typical database, starting with an ID followed by variables >in column and individuals in rows: > >ID VAR1 VAR2... >1 >2 >3 >4 >5 >etc. > >I would like to add rows, say 4, between each pre-existing row, to >get something like this: > >ID VAR1 VAR2... >1 >. >. >. >. >2 >. >etc. Do you want the added rows to have all values system-missing (or blank, for strings), or do you want some values carried over from the preceding original record? ===================== 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 |
|
In reply to this post by Eric Janssen
Shalom
There is many ways to do what you want here is a simple one . run name Frequencies Across Many Variables . new file . dataset close all . input program. numeric id v1 to v8 v5c(f2) . vector vv= v1 to v8. loop id=1 to 10 . loop i=1 to 8 . compute vv(i)=trunc(UNIFORM(13)). end loop . end case . end loop . end file . end input program. execute. compute isadd=2. xsave outfile= tmp.sav / keep=id isadd. execute . add files file=* /file= tmp.sav /file= tmp.sav /file= tmp.sav / keep=id isadd v1 to v8 . sort cases by id isadd. Hillel Vardi BGU Eric Janssen wrote: > Dear all > > I have a typical database, starting with an ID followed by variables in column > and individuals in rows: > > ID VAR1 VAR2... > 1 > 2 > 3 > 4 > 5 > etc. > > I would like to add rows, say 4, between each pre-existing row, to get something > like this: > > ID VAR1 VAR2... > 1 > . > . > . > . > 2 > . > . > . > . > 3 > . > . > . > . > etc. > Any suggestion? > Thanks for your inspiration > Eric > > ===================== > 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 > > ===================== 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 |
