From colom to row with multiple variables

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

From colom to row with multiple variables

Juleke2
Dear all,

 I would like to restructure my data in the following way:

<http://spssx-discussion.1045642.n5.nabble.com/file/t341365/Table_format.png>

 Does anyone know how to do this in SPSS?

 Many thanks in advance!!





--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: From colom to row with multiple variables

David Marso
Administrator
Rather unusable resulting data structure in my opinion, but here goes:

IF $CASENUM EQ 1 OR Group NE LAG (Group ) casenum=1.
IF  Group EQ LAG (Group) casenum=LAG (casenum)+ 1.
SORT CASES BY casenum.
COMPUTE CopyGp=Group.
FORMATS ALL (F2.0).
CASESTOVARS /ID=casenum/INDEX=CopyGP/ GROUPBY INDEX.
DELETE VARIABLES casenum.

PLEASE IN THE FUTURE POST SAMPLE DATA AS TEXT AND NOT A BLOODY GRAPHIC..
WE CAN'T PASTE A GRAPHIC INTO A DATASET OR SYNTAX FILE.



-----
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?"
--
Sent from: http://spssx-discussion.1045642.n5.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
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?"
Reply | Threaded
Open this post in threaded view
|

Re: From colom to row with multiple variables

Bruce Weaver
Administrator
I agree with David about the usability of this data structure.  

If you really do want this, and if it is important for the variables to be
named as you showed, then add a /SEPARATOR sub-command to David's
CASESTOVARS line, like this:

CASESTOVARS /ID=casenum /INDEX=CopyGP /GROUPBY INDEX /SEPARATOR="".




David Marso wrote

> Rather unusable resulting data structure in my opinion, but here goes:
>
> IF $CASENUM EQ 1 OR Group NE LAG (Group ) casenum=1.
> IF  Group EQ LAG (Group) casenum=LAG (casenum)+ 1.
> SORT CASES BY casenum.
> COMPUTE CopyGp=Group.
> FORMATS ALL (F2.0).
> CASESTOVARS /ID=casenum/INDEX=CopyGP/ GROUPBY INDEX.
> DELETE VARIABLES casenum.
>
> PLEASE IN THE FUTURE POST SAMPLE DATA AS TEXT AND NOT A BLOODY GRAPHIC..
> WE CAN'T PASTE A GRAPHIC INTO A DATASET OR SYNTAX FILE.
>
>
>
> -----
> 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?"
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
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/).
Reply | Threaded
Open this post in threaded view
|

Re: From colom to row with multiple variables

Juleke2
In reply to this post by David Marso
Thanks so much! It worked!!



--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: From colom to row with multiple variables

Juleke2
In reply to this post by Bruce Weaver
Thanks! It worked!!



--
Sent from: http://spssx-discussion.1045642.n5.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