Date: Fri, 18 Jun 2004 10:08:04 +1000
Reply-To: Simon Freidin <simonpf@unimelb.edu.au>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Simon Freidin <simonpf@unimelb.edu.au>
Subject: Re: Error with Casestovars command
In-Reply-To: <000b01c45456$167e67c0$0501a8c0@lavolta.ch>
Content-Type: text/plain; charset="iso-8859-1"; format=flowed
This is an untrapped condition, let SPSS know.
Workaround below.
data list /id 2 time 5-11 (a) score 13-14.
begin data.
1 before 73
end data.
list.
sort cases by id time .
*count number of cases and match to file .
compute nobreak=1.
aggregate outfile='c:\temp\x.sav'/break=nobreak/n=n.
match files file=*/file='c:\temp\x.sav'/by nobreak.
* if more than 1 case write casestovars command.
do if n>1.
write outfile='c:\temp\casestovars.sps'
/'casestovars'
/' /id = id'
/' /index = time'
/' /groupby = variable.'.
else.
write outfile='c:\temp\casestovars.sps'/' '.
end if.
exe.
include 'c:\temp\casestovars.sps'.
erase file='c:\temp\casestovars.sps'.
compute dummy = 1.
exec.
At 08:30 PM 6/17/2004, la volta statistics wrote:
>Dear all
>
>I have problem with the CASESTOVARS command.
>When I use the command for a file that happens to have only one case I get
>an error when I subsequently want to compute a new variable (see syntax
>below). I know this is a rare case, but since I create the data file
>dynamically, I do not know beforehand if only one or more cases are
>available. Has anybody found a solution for this problem.
>
>DATA LIST /ID 2 TIME 5-11 (A) SCORE 13-14.
>begin data.
> 1 before 73
>end data.
>
>LIST.
>
>SORT CASES BY ID TIME .
>CASESTOVARS
> /ID = ID
> /INDEX = TIME
> /GROUPBY = VARIABLE.
>
>Compute dummy = 1.
>Exec.
>
>Thanks in advance, Christian
>
>*******************************
>la volta statistics
>Christian Schmidhauser, Dr.phil.II
>Weinbergstrasse 108
>Ch-8006 Zürich
>Tel: +41 (043) 233 98 01
>Fax: +41 (043) 233 98 02
>mailto:schmidhauser@lavolta.ch
Research Database Manager and Analyst
Melbourne Institute of Applied Economic and Social Research
The University of Melbourne
Melbourne VIC 3010 Australia
New Tel: (03) 8344 2085 New Fax: (03) 8344 2111
http://www.melbourneinstitute.com/hilda/