Date: Wed, 16 Oct 2002 10:16:36 -0500
Reply-To: Carol Albright <calbright@VISI.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Carol Albright <calbright@VISI.COM>
Subject: Re: Flipping rows and columns, sort of
In-Reply-To: <1B415E1E-E10C-11D6-B29A-0003939BD016@cluemail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi, Rick & Listers,
This isn't glamourous, but it works if I understood your quandry. Flip
your file to get one record per behavior, and since you already know what
the possible responses are, why not just count them? Modify the syntax
below so the COUNT commands count all your cases (you'll end up with one
per line in your original file, so say you have 1000 records, change var006
to var1000 (?) depending on what SPSS calls it).
*** SYNTAX IS HERE ***.
DATA LIST LIST /ID(F1), DATE(ADATE8), AGE, HOP, SKIP, JUMP(4F2).
BEGIN DATA
1 01/01/02 12.00 0 0 1
1 06/01/02 13.00 1 1 0
2 01/15/02 9.00 1 2 2
2 07/12/02 9.00 2 2 0
2 08/15/02 10.00 1 1 0
3 02/15/02 13.00 1 1 0
END DATA.
LIST.
SORT CASES BY id.
SAVE OUTFILE='c:\temp\play.sav'.
FLIP VARIABLES=hop skip jump .
COUNT Zero = var001 to var006 (0).
count ones = var001 to var006 (1).
count twos = var001 to var006 (2).
VARIABLE LABELS Zero "# of Zero's" .
EXECUTE .
save outfile='c:\temp\counts.sav'/keep=case_lbl zero ones twos.
get file='c:\temp\counts.sav'.
exe.
list all.
*****.
*** SAMPLE FINAL OUTPUT IS HERE ***.
***.
List
CASE_LBL ZERO ONES TWOS
HOP 1.00 4.00 1.00
SKIP 1.00 3.00 2.00
JUMP 4.00 1.00 1.00
Number of cases read: 3 Number of cases listed: 3
hth,
Carol
At 03:35 PM 10/16/02 +0200, Rick Fannon wrote:
>Anyone remember the easy way to do this?
>
>I have a file where the cases are individuals at a particular time
>(some individuals at several times,) a series of variables representing
>behaviours with values 0/1/2, and the age of each individual as another
>variable. I need a file where the cases are the individual measures of
>behaviour, with variables showing how many individual cases in the
>original file had which value for that (original) variable. It's
<snip>
-------------------------------------------------------------------------
Carol L. Albright, MS | E-Mail : calbright@visi.com
Albright Consulting | Phone : 651/699-7218
St. Paul, MN 55105 USA | Research data services
http://www.tc.umn.edu/~syzygy
-------------------------------------------------------------------------
|