vars to cases with 11.5.1 -- yet again

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

vars to cases with 11.5.1 -- yet again

Raffe, Sydelle, SSA
Yet more clarification:

I have a data set which has 3 sets of 4 variables each. I'm using data>restructure>vars to cases. I'm trying to move the last 2 groups into the first 4 columns of the data file as follows:

        aaaabbbbccccdddd to

        aaaa
        bbbb
        cccc
        dddd

Here is a file with 2 rows of actual data.

         
The data types are a's (a10), b's (a9), c's (a13), d's (a8).

Thinking the different data lengths might be a problem, I changed them all to a13. This got me further in the menus but when it asked about indexes, and levels, etc., I kind of lost it. Tried a couple of things, but haven't gotten the solution yet. Below is output I tried last. Thanks again.

GET
  FILE='M:\Monthly Data Files\Active CFS Cases\sample data.sav'.
SAVE OUTFILE='M:\Monthly Data Files\Active CFS Cases\sample data.sav'
 /COMPRESSED.
VARSTOCASES  /MAKE trans1 FROM focbdate focssn foclname focfname
 /MAKE trans2 FROM cbdate cssn clname cfname
 /MAKE trans3 FROM relbdate relssn relname relfname
 /INDEX = Index1 "bdate"(4) Index2 "ssn"(1) Index3 "lname"(1) Index4 "fname"(1)
 /KEEP =
 /NULL = KEEP.
Variables to Cases
 


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: vars to cases with 11.5.1

Richard Ristow
At 09:16 PM 10/8/2006, Raffe, Sydelle, SSA wrote:

>I have a data set which has 3 sets of 4 variables each. I'm using
>data>restructure>vars to cases. I'm trying to move the last 2 groups
>into the first 4 columns of the data file as follows:
>
>         aaaabbbbccccdddd to
>
>         aaaa
>         bbbb
>         cccc
>         dddd
>
>Here is a file with 2 rows of actual data.

Nope. Your data still isn't there; at least, it didn't get through
whatever distribution node serves me. What did you do, to paste it into
your message?

>The data types are a's (a10), b's (a9), c's (a13), d's (a8).
>
>Below is output I tried last. Thanks again.
>
>VARSTOCASES  /MAKE trans1 FROM focbdate focssn foclname focfname
>  /MAKE trans2 FROM cbdate cssn clname cfname
>  /MAKE trans3 FROM relbdate relssn relname relfname
>  /INDEX = Index1 "bdate"(4) Index2 "ssn"(1) Index3 "lname"(1) Index4
> "fname"(1)
>  /KEEP =
>  /NULL = KEEP.

You don't include your error messages, but your problem is clear
enough.

You want all the birthdates in the same variable, all the SSNs in one,
all the lnames in one, and all the fnames in one. Instead, you have

>/MAKE trans1 FROM focbdate focssn foclname focfname

which tries to put all your a's, which are different datatypes, in one
VARIABLE. You can see it from your INDEX:

>  /INDEX = Index1 "bdate"(4) Index2 "ssn"(1) Index3
>           "lname"(1) Index4 "fname"(1)

which tries to create a separate *case*, not variable, for each group -
a,b,c,d.

I ran a test before I looked at your code, so my variable names aren't
what you have, but my datatypes are: "a's (a10), b's (a9), c's (a13),
d's (a8). I clicked up the following VARSTOCASES, and it worked the
first time. (It was a nuisance to click up; writing the syntax would
have been easier.)

This is SPSS draft output, 14.0.2:

List
|-----------------------------|---------------------------|
|Output Created               |09-OCT-2006 13:28:11       |
|-----------------------------|---------------------------|
The variables are listed in the following order:
LINE   1: ID ID_SPACE
LINE   2: a1 b1 c1 d1 SPACE
LINE   3: a2 b2 c2 d2 SPACE
LINE   4: a3 b3 c3 d3 SPACE
LINE   5: a4 b4 c4 d4 SPACE

           ID: Names1
           a1: Aaron      Benjamin  Cuthbert      Dickens
           a2: Albert     Bernard   Charles       deKalb
           a3: Andrew     Bill      Christopher   Downing
           a4: Alfred     Bonnard   Cruise        Doerr

           ID: Names2
           a1: Alice      Beatrice  Catherine     Dickens
           a2: Agnes      Betsy     Cynthia       deKalb
           a3: Amy        Belinda   Christine     Downing
           a4: Anunzia    Beata     Constance     Doerr

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


VARSTOCASES  /MAKE a FROM a1 a2 a3 a4
  /MAKE b FROM b1 b2 b3 b4
  /MAKE c FROM c1 c2 c3 c4
  /MAKE d FROM d1 d2 d3 d4
  /INDEX = NameNmbr(4)
  /KEEP =  ID
  /NULL = KEEP.

Variables to Cases
|--------------------------|---------------------------|
|Output Created            |09-OCT-2006 13:28:11       |
|--------------------------|---------------------------|
Generated Variables
|--------|------|
|Name    |Label |
|--------|------|
|NameNmbr|<none>|
|a       |<none>|
|b       |<none>|
|c       |<none>|
|d       |<none>|
|--------|------|

Processing Statistics
|-------------|--|
|Variables In |17|
|Variables Out|6 |
|-------------|--|


LIST.

List
|-----------------------------|---------------------------|
|Output Created               |09-OCT-2006 13:28:11       |
|-----------------------------|---------------------------|
ID     NameNmbr a          b         c             d

Names1      1   Aaron      Benjamin  Cuthbert      Dickens
Names1      2   Albert     Bernard   Charles       deKalb
Names1      3   Andrew     Bill      Christopher   Downing
Names1      4   Alfred     Bonnard   Cruise        Doerr
Names2      1   Alice      Beatrice  Catherine     Dickens
Names2      2   Agnes      Betsy     Cynthia       deKalb
Names2      3   Amy        Belinda   Christine     Downing
Names2      4   Anunzia    Beata     Constance     Doerr

Number of cases read:  8    Number of cases listed:  8