Cases to variables

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

Cases to variables

Sibusiso Moyo
Dear List,

I am trying to transform my data from long to wide format: My list of variables are ID1; ID2; ID3; ID4; var1; var2; var3; index.

If I have one variable (var1) to transform to wide formart I ran the following syntax and it works:

Sort cases by ID1 ID3 ID4 index.
Casestovars
        /id=ID1 ID3 ID4
        /index=index
        /drop=var2 var3 ID2
        /GROUPBY = VARIABLE .
list.

But now I want to have two variables transformed, and its not working. The two variables are var1 and var3.

This is what I ran and it work work. Any help?

Sort cases by ID1 ID2 ID3 ID4 index.
Casestovars
        /id= ID1 ID2 ID3 ID4
        /index=index
        /drop=var2
        /GROUPBY = VARIABLE .
list.

Thanks in advance,

Sibusiso.
Reply | Threaded
Open this post in threaded view
|

Re: Cases to variables

Richard Ristow
At 03:20 PM 6/27/2006, Sibusiso Moyo wrote:

>I am trying to transform my data from long to wide format: My list of
>variables are ID1; ID2; ID3; ID4; var1; var2; var3; index.

I notice nobody has answered this. I find I don't understand it, and I
haven't been able to make satisfactory test data. Can you post some
test data? I'm particularly interested in what values occur for INDEX.

>If I have one variable (var1) to transform to wide formart I ran the
>following syntax and it works:
>
>Sort cases by ID1 ID3 ID4 index.
>Casestovars
>         /id=ID1 ID3 ID4
>         /index=index
>         /drop=var2 var3 ID2
>         /GROUPBY = VARIABLE .
>list.
>
>[But] This is what I ran and it work work. Any help?
>
>Sort cases by ID1 ID2 ID3 ID4 index.
>Casestovars
>         /id= ID1 ID2 ID3 ID4
>         /index=index
>         /drop=var2
>         /GROUPBY = VARIABLE .
>list.

And - it's never the best to say "it doesn't work." If it gives you
error messages, what messages? If it give you no messages, but you
don't get what you wanted, what did you want, and what did you get
instead?

-Good luck,
  Richard
Reply | Threaded
Open this post in threaded view
|

Re: Cases to variables

Sibusiso Moyo
In reply to this post by Sibusiso Moyo
Richard,

I have solved this problem; but I could still send you test data if you still interested in looking at it.

Sibusiso.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of
Richard Ristow
Sent: Friday, June 30, 2006 1:12 AM
To: [hidden email]
Subject: Re: Cases to variables


At 03:20 PM 6/27/2006, Sibusiso Moyo wrote:

>I am trying to transform my data from long to wide format: My list of
>variables are ID1; ID2; ID3; ID4; var1; var2; var3; index.

I notice nobody has answered this. I find I don't understand it, and I
haven't been able to make satisfactory test data. Can you post some
test data? I'm particularly interested in what values occur for INDEX.

>If I have one variable (var1) to transform to wide formart I ran the
>following syntax and it works:
>
>Sort cases by ID1 ID3 ID4 index.
>Casestovars
>         /id=ID1 ID3 ID4
>         /index=index
>         /drop=var2 var3 ID2
>         /GROUPBY = VARIABLE .
>list.
>
>[But] This is what I ran and it work work. Any help?
>
>Sort cases by ID1 ID2 ID3 ID4 index.
>Casestovars
>         /id= ID1 ID2 ID3 ID4
>         /index=index
>         /drop=var2
>         /GROUPBY = VARIABLE .
>list.

And - it's never the best to say "it doesn't work." If it gives you
error messages, what messages? If it give you no messages, but you
don't get what you wanted, what did you want, and what did you get
instead?

-Good luck,
  Richard