Date: Fri, 14 Jan 2011 09:11:19 -0500
Reply-To: Jeanne Eidex <jeidex@eidexgroup.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Jeanne Eidex <jeidex@eidexgroup.com>
Subject: Macro Question: Conditionally Saving Outfiles
Content-Type: multipart/alternative;
Hi Everyone,
I am writing a program that needs to parse out data into separate files in
the end. The syntax works, but, the problem is that it writes an empty data
file if conditions are not met, so, if my master file for this month does
not have anyone (a row) with group2=1 then it writes an empty data file
called group2.sav. There are a large number of groups, so, it's very
inconvenient to have the empty data files.
This would be in a loop or do repeat statement but you can't combine it with
"save outfile" I thought maybe a macro fix this, it might make it more
efficient, possibly with the ERASE command which I have never used. Please
let me know if you have any suggestions.
temporary.
select if GROUP1=1.
save outfile='e:\TEST\GROUP1.sav'
/KEEP= RESPID GROUP1_MEMBER Q1 Q2 Q3.
temporary.
select if GROUP2=1.
save outfile='e:\TEST\GROUP2.sav'
/KEEP= RESPID GROUP2 Q1 Q2 Q3.
temporary.
select if GROUP3=1.
save outfile='e:\TEST\GROUP3.sav'
/KEEP= RESPID GROUP3 Q1 Q2 Q3.
Sincerely,
Jeanne Eidex
Eidex Group, LLC
www.eidexgroup.com
office: 770.614.6334
fax: 678.623.3931
[text/html]
|