Date: Fri, 14 Jan 2011 09:11:19 -0500
Reply-To: Jeanne Eidex <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Jeanne Eidex <email@example.com>
Subject: Macro Question: Conditionally Saving Outfiles
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.
select if GROUP1=1.
/KEEP= RESPID GROUP1_MEMBER Q1 Q2 Q3.
select if GROUP2=1.
/KEEP= RESPID GROUP2 Q1 Q2 Q3.
select if GROUP3=1.
/KEEP= RESPID GROUP3 Q1 Q2 Q3.
Eidex Group, LLC