transpose data?

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

transpose data?

msherman

Dear list:  I have the following data that I need to change. It looks like this.

 

SS   V1  V2  V3  V4

1      3     4     8      15

1      6      2    3       11

1      4      8   13      12

2       4     8    1        17

2       8     2    13      21

2       7    2     4        10

 

I want the data to look like this.

 

SS       V11   V12   V13   V21  V22  V23  V31  V32  V33   V41  V42   V43

1           3         6        4          4       2        8       8       3       13       15     11    12

1           4          8       7          8        2       2        1     13      4         `7       21    10  

 

Suggestions welcomed.  Thanks,

                                                                                                                                                                             
Martin F. Sherman, Ph.D.

Professor of Psychology

Director of Masters Education: Thesis Track
Loyola College of Arts and Sciences

 

                                                                                                                                                                             

 

Reply | Threaded
Open this post in threaded view
|

Re: transpose data?

Maguin, Eugene
Martin, why won't casestovars work?

Gene Maguin


>>>Dear list:  I have the following data that I need to change. It looks
like this.

SS   V1  V2  V3  V4
1      3     4     8      15
1      6      2    3       11
1      4      8   13      12
2       4     8    1        17
2       8     2    13      21
2       7    2     4        10

I want the data to look like this.

SS    V11   V12   V13   V21  V22  V23  V31  V32  V33   V41  V42   V43
1       3    6      4     4    2    8    8    3   13    15   11    12
1       4    8      7     8    2    2    1   13    4     7   21    10

Suggestions welcomed.  Thanks,


Martin F. Sherman, Ph.D.
Professor of Psychology
Director of Masters Education: Thesis Track
Loyola College of Arts and Sciences

=====================
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: transpose data?

Marta Garcia-Granero
In reply to this post by msherman
Martin Sherman wrote:

>
> Dear list:  I have the following data that I need to change. It looks
> like this.
>
>
>
> SS   V1  V2  V3  V4
>
> 1      3     4     8      15
>
> 1      6      2    3       11
>
> 1      4      8   13      12
>
> 2       4     8    1        17
>
> 2       8     2    13      21
>
> 2       7    2     4        10
>
>
>
> I want the data to look like this.
>
>
>
> SS       V11   V12   V13   V21  V22  V23  V31  V32  V33   V41  V42   V43
>
> 1           3         6        4          4       2        8
> 8       3       13       15     11    12
>
> 1           4          8       7          8        2       2
> 1     13      4         `7       21    10
>

Hi Martin:

I think you are being a bit lazy ;) Did you try CASESTOVARS (using the
GUI) before asking? The solution is really straightforward:

CASESTOVARS
 /ID = SS
 /GROUPBY = VARIABLE .
LIST.

The only difference is that the new variables are V1.1 V1.2 V1.3...,
instead of V11, V12, V13... Is that the problem?

Best regards,
Marta GG

--
For miscellaneous SPSS related statistical stuff, visit:
http://gjyp.nl/marta/

=====================
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: transpose data?

Bruce Weaver
Administrator
Marta GarcĂ­a-Granero-2 wrote
Martin Sherman wrote:
>
> Dear list:  I have the following data that I need to change. It looks
> like this.
>
>
>
> SS   V1  V2  V3  V4
>
> 1      3     4     8      15
>
> 1      6      2    3       11
>
> 1      4      8   13      12
>
> 2       4     8    1        17
>
> 2       8     2    13      21
>
> 2       7    2     4        10
>
>
>
> I want the data to look like this.
>
>
>
> SS       V11   V12   V13   V21  V22  V23  V31  V32  V33   V41  V42   V43
>
> 1           3         6        4          4       2        8
> 8       3       13       15     11    12
>
> 1           4          8       7          8        2       2
> 1     13      4         `7       21    10
>

Hi Martin:

I think you are being a bit lazy ;) Did you try CASESTOVARS (using the
GUI) before asking? The solution is really straightforward:

CASESTOVARS
 /ID = SS
 /GROUPBY = VARIABLE .
LIST.

The only difference is that the new variables are V1.1 V1.2 V1.3...,
instead of V11, V12, V13... Is that the problem?

Best regards,
Marta GG
If the variable names have to be V11 V12 V13 etc, add a SEPARATOR sub-command, like this:

CASESTOVARS
 /ID = SS
 /SEPARATOR = ""
 /GROUPBY = VARIABLE .

--
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/).