Stacking columns without creating separate datafiles

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Stacking columns without creating separate datafiles

Margaret MacDougall
Hello

I would grateful to learn from anyone who can suggest some SPSS syntax to address the following problem.
 
Suppose I have 50 columns - one for each of variables v1, v2, ...., v50 - pertaining to velocity taken at 50 separate time points and that I also have a participant identifier column 'idcode' containing numerical codes for the participants to which these velocities apply. As such, the 50 columns pertain to repeated measures across the same participants. I now wish to stack the velocity columns into a single column while retaining the current orders of the velocity readings within the 50 individual columns. In other words, there should be a simple stacking of columns in the order v1-v50 with no re-ordering of the contents of the individual columns v1-v50. I do not wish to create 50 separate datafiles to accomplish a merge. However, I would like to work within the existing datafile to merge the columns. Doing this manually would not make a great deal of sense, as there are many participants in the study, rendering the copy-paste procedure open to errors. I do not wish to assume that the 50 columns sit side-by-side; rather, there may be columns for other data separating them.
 
Thanks in advance.
 
Best wishes
 
Margaret  
===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Stacking columns without creating separate datafiles

Andy W
The command

VARSTOCASES /MAKE V FROM V1 TO V50 /INDEX Order.

sounds to me like it will do what you want.
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: Stacking columns without creating separate datafiles

Ryan
In reply to this post by Margaret MacDougall
VARSTOCASES

Ryan 

Sent from my iPhone

On Aug 13, 2016, at 2:54 AM, [hidden email] wrote:

Hello

I would grateful to learn from anyone who can suggest some SPSS syntax to address the following problem.
 
Suppose I have 50 columns - one for each of variables v1, v2, ...., v50 - pertaining to velocity taken at 50 separate time points and that I also have a participant identifier column 'idcode' containing numerical codes for the participants to which these velocities apply. As such, the 50 columns pertain to repeated measures across the same participants. I now wish to stack the velocity columns into a single column while retaining the current orders of the velocity readings within the 50 individual columns. In other words, there should be a simple stacking of columns in the order v1-v50 with no re-ordering of the contents of the individual columns v1-v50. I do not wish to create 50 separate datafiles to accomplish a merge. However, I would like to work within the existing datafile to merge the columns. Doing this manually would not make a great deal of sense, as there are many participants in the study, rendering the copy-paste procedure open to errors. I do not wish to assume that the 50 columns sit side-by-side; rather, there may be columns for other data separating them.
 
Thanks in advance.
 
Best wishes
 
Margaret  
===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Stacking columns without creating separate datafiles

Margaret MacDougall
In reply to this post by Andy W
Not quite, Andy  (according to the exact wording of my original query). However, with further practise and reading I have noted how to uses the command VARSTOCASES as a starting point and subsequently arranged the data as wanted fairly efficiently. Therefore thanks for suggesting this command.

Best wishes

Margaret

 



From: Andy W <[hidden email]>
To: [hidden email]
Sent: Saturday, 13 August 2016, 17:21
Subject: Re: Stacking columns without creating separate datafiles

The command

VARSTOCASES /MAKE V FROM V1 TO V50 /INDEX Order.

sounds to me like it will do what you want.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Stacking-columns-without-creating-separate-datafiles-tp5732886p5732888.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Stacking columns without creating separate datafiles

David Marso
Administrator
In what manner does Andy's suggestion deviate from "the exact wording of" your "original query"?
---
Margaret MacDougall wrote
Not quite, Andy  (according to the exact wording of my original query). However, with further practise and reading I have noted how to uses the command VARSTOCASES as a starting point and subsequently arranged the data as wanted fairly efficiently. Therefore thanks for suggesting this command.
Best wishes
Margaret
 

 
      From: Andy W <[hidden email]>
 To: [hidden email] 
 Sent: Saturday, 13 August 2016, 17:21
 Subject: Re: Stacking columns without creating separate datafiles
   
The command

VARSTOCASES /MAKE V FROM V1 TO V50 /INDEX Order.

sounds to me like it will do what you want.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Stacking-columns-without-creating-separate-datafiles-tp5732886p5732888.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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
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?"