restructuring vars to cses

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

restructuring vars to cses

Raffe, Sydelle, SSA
Hi folks. I'm working in 11.5 and using the restructure data wizard (which I've used successfully many times).

I have a data set with 8 variables. I want to take the last 4 variables and make them cases. I want to end up with only 4 variables in the dataset. I don't care about connecting those transposed vars to the same record. I just want to mechanically  move these four vars to line up under the first 4 vars. I get just so far in the wizard and the next or finish box never becomes selectable.

I also tried adding a sequential id number to the file but this didn't help.

How can I do this? Thanks.

Sydelle Raffe, Alameda County Social Services Agency
Information Services Division
e:mail:  [hidden email]
phone: 510-271-9174     fax: 510-271-9107
If you have a request for information, please submit an ODM request form at:  https://alamedasocialservices.org/staff/support_services/statistics_and_reports/odm/index.cfm
Reply | Threaded
Open this post in threaded view
|

Re: restructuring vars to cses

Maguin, Eugene
Sydelle,

I may be misunderstanding what you want but it seems to me that you could be
saying several different things. You say:

>>I have a data set with 8 variables. I want to take the last 4 variables
and make them cases. I want to end up with only 4 variables in the dataset.
I don't care about connecting those transposed vars to the same record.

So why not just do a save outfile and keep the last four variables? Or, you
could match the file to itself and keep the last four vars? Anyway, then you
say

>>I just want to mechanically  move these four vars to line up under the
first 4 vars.

So now it sounds like you want to go from

Id x1 x2 x3 x4 x5 x6 x7 x8

To

Id x1 x2 x3 x4
x5 x6 x7 x8

If this is true, then I'm not sure you can do that using Varstocases because
the procedure wants to treat x5 thru x7 as repeated measures of a common
measure. So, I'd suggest saving x5 thru x8 to a temporary outfile and then
adding them back to the original file. However, you'll need to do something
about names. Do you intend that x5 thru x8 become x1 thru x4? Do you intend
that x5 thru x8 just move do down to a new record but retain their names so
that the result looks like this (. = sysmis)?

Id x1 x2 x3 x4   .  .  .  .
 .  .  .  .  .  x5 x6 x7 x8

Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: restructuring vars to cses

Beadle, ViAnn
In reply to this post by Raffe, Sydelle, SSA
In what format is your data set, SPSS data file, text, ODBC query, or something else?
Do you want to end up with double the number of cases (records) that you start with or just half the variables that you start with with?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Raffe, Sydelle, SSA
Sent: Tuesday, December 26, 2006 12:50 PM
To: [hidden email]
Subject: restructuring vars to cses

Hi folks. I'm working in 11.5 and using the restructure data wizard (which I've used successfully many times).

I have a data set with 8 variables. I want to take the last 4 variables and make them cases. I want to end up with only 4 variables in the dataset. I don't care about connecting those transposed vars to the same record. I just want to mechanically  move these four vars to line up under the first 4 vars. I get just so far in the wizard and the next or finish box never becomes selectable.

I also tried adding a sequential id number to the file but this didn't help.

How can I do this? Thanks.

Sydelle Raffe, Alameda County Social Services Agency
Information Services Division
e:mail:  [hidden email]
phone: 510-271-9174     fax: 510-271-9107
If you have a request for information, please submit an ODM request form at:  https://alamedasocialservices.org/staff/support_services/statistics_and_reports/odm/index.cfm
Reply | Threaded
Open this post in threaded view
|

Re: restructuring vars to cses

Richard Ristow
In reply to this post by Maguin, Eugene
At 02:40 PM 12/26/2006, Gene Maguin wrote:

>>I have a data set with 8 variables. I want to take the last 4
>>variables and make them cases. I want to end up with only 4 variables
>>in the dataset.I don't care about connecting those transposed vars to
>>the same record. >>I just want to mechanically  move these four vars
>>to line up under the first 4 vars.
>
>So now it sounds like you want to go from
>Id x1 x2 x3 x4 x5 x6 x7 x8
>
>To
>Id x1 x2 x3 x4
>x5 x6 x7 x8
>
>If this is true, then I'm not sure you can do that using Varstocases.

I'm not sure what's wanted either, but the effect Gene is describing
can be got with VARSTOCASES: see the following, SPSS 14 draft output.
(Note to self: syntax & listing not saved separately.) It can be
clicked up - it was. In the "Restructure cases to variables" dialog,
second panel, specify 4 variable groups and proceed.

LIST.

List
|-----------------------------|---------------------------|
|Output Created               |27-DEC-2006 12:29:22       |
|-----------------------------|---------------------------|
ID X1      X2      X3      X4      X5      X6      X7      X8

  1 A       B       C       D       Alpha   Beta    Gamma   Delta
  2 E       Z       Et      Th      Epsilon Zeta    Eta     Theta

Number of cases read:  2    Number of cases listed:  2


VARSTOCASES  /MAKE Group1 FROM X1 X5
  /MAKE Group2 FROM X2 X6
  /MAKE Group3 FROM X3 X7
  /MAKE Group4 FROM X4 X8
  /KEEP =  ID
  /NULL = KEEP.


Variables to Cases
|--------------------------|---------------------------|
|Output Created            |27-DEC-2006 12:29:22       |
|--------------------------|---------------------------|

Generated Variables
|------|------|
|Name  |Label |
|------|------|
|Group1|<none>|
|Group2|<none>|
|Group3|<none>|
|Group4|<none>|
|------|------|

Processing Statistics
|-------------|-|
|Variables In |9|
|Variables Out|5|
|-------------|-|


LIST.

List
|-----------------------------|---------------------------|
|Output Created               |27-DEC-2006 12:29:22       |
|-----------------------------|---------------------------|
ID Group1   Group2   Group3   Group4

  1 A        B        C        D
  1 Alpha    Beta     Gamma    Delta
  2 E        Z        Et       Th
  2 Epsilon  Zeta     Eta      Theta

Number of cases read:  4    Number of cases listed:  4




===================
APPENDIX: TEST DATA
===================
*  Test data .
DATA LIST FREE /
   ID       (N2)
   X1 TO X8 (8A8).
BEGIN DATA
1
A B C D
Alpha
Beta
Gamma
   Delta
2
E Z Et Th
   Epsilon
   Zeta
   Eta
   Theta
END DATA.




.
Reply | Threaded
Open this post in threaded view
|

Re: restructuring vars to cses

Raffe, Sydelle, SSA
In reply to this post by Raffe, Sydelle, SSA
Thank you. That's what I was trying to do. I ended up using Gene's suggestion of just splitting the vars into 2 files and then just adding files. Now I have another way.

-----Original Message-----
From: Richard Ristow [mailto:[hidden email]]
Sent: Wednesday, December 27, 2006 9:40 AM
To: Gene Maguin; [hidden email]
Cc: Raffe, Sydelle, SSA
Subject: Re: restructuring vars to cses


At 02:40 PM 12/26/2006, Gene Maguin wrote:

>>I have a data set with 8 variables. I want to take the last 4
>>variables and make them cases. I want to end up with only 4 variables
>>in the dataset.I don't care about connecting those transposed vars to
>>the same record. >>I just want to mechanically  move these four vars
>>to line up under the first 4 vars.
>
>So now it sounds like you want to go from
>Id x1 x2 x3 x4 x5 x6 x7 x8
>
>To
>Id x1 x2 x3 x4
>x5 x6 x7 x8
>
>If this is true, then I'm not sure you can do that using Varstocases.

I'm not sure what's wanted either, but the effect Gene is describing
can be got with VARSTOCASES: see the following, SPSS 14 draft output.
(Note to self: syntax & listing not saved separately.) It can be
clicked up - it was. In the "Restructure cases to variables" dialog,
second panel, specify 4 variable groups and proceed.

LIST.

List
|-----------------------------|---------------------------|
|Output Created               |27-DEC-2006 12:29:22       |
|-----------------------------|---------------------------|
ID X1      X2      X3      X4      X5      X6      X7      X8

  1 A       B       C       D       Alpha   Beta    Gamma   Delta
  2 E       Z       Et      Th      Epsilon Zeta    Eta     Theta

Number of cases read:  2    Number of cases listed:  2


VARSTOCASES  /MAKE Group1 FROM X1 X5
  /MAKE Group2 FROM X2 X6
  /MAKE Group3 FROM X3 X7
  /MAKE Group4 FROM X4 X8
  /KEEP =  ID
  /NULL = KEEP.


Variables to Cases
|--------------------------|---------------------------|
|Output Created            |27-DEC-2006 12:29:22       |
|--------------------------|---------------------------|

Generated Variables
|------|------|
|Name  |Label |
|------|------|
|Group1|<none>|
|Group2|<none>|
|Group3|<none>|
|Group4|<none>|
|------|------|

Processing Statistics
|-------------|-|
|Variables In |9|
|Variables Out|5|
|-------------|-|


LIST.

List
|-----------------------------|---------------------------|
|Output Created               |27-DEC-2006 12:29:22       |
|-----------------------------|---------------------------|
ID Group1   Group2   Group3   Group4

  1 A        B        C        D
  1 Alpha    Beta     Gamma    Delta
  2 E        Z        Et       Th
  2 Epsilon  Zeta     Eta      Theta

Number of cases read:  4    Number of cases listed:  4




===================
APPENDIX: TEST DATA
===================
*  Test data .
DATA LIST FREE /
   ID       (N2)
   X1 TO X8 (8A8).
BEGIN DATA
1
A B C D
Alpha
Beta
Gamma
   Delta
2
E Z Et Th
   Epsilon
   Zeta
   Eta
   Theta
END DATA.




.