Date: Wed, 21 Sep 2005 17:50:08 -0400
Reply-To: Richard Ristow <wrristow@mindspring.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <wrristow@mindspring.com>
Subject: Re: datestamp in output file name
In-Reply-To: <E07BCCA62696AB40BE1267A7419A281A039BB3D7@liam.affina.com>
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 02:31 PM 9/21/2005, Vishal Dave wrote:
>I use SPSS 13.0 and use macro to assign date to the data. The
>following
>sample code saves the data with name DATAmmddyyyy format in C:\TEMP
>folder.
It's fine, but there's no need to use three separate output files.
Instead, develop the name BEFORE you write it out, and write it once:
Untested code, but like this. Or see my posting of Wed, 24 Aug 2005
17:43:26 -0400, which was tested (though not recently).
Instead of
DO IF $casenum=1.
WRITE OUTFILE 'c:\temp\temp1.sps' /"DEFINE !year()
'"#cyear"'!ENDDEFINE.".
END IF.
DO IF $casenum=1.
WRITE OUTFILE 'c:\temp\temp2.sps' /"DEFINE !month()
'"#cmonth"'!ENDDEFINE.".
END IF.
DO IF $casenum=1.
WRITE OUTFILE 'c:\temp\temp3.sps' /"DEFINE !day()
'"#cday"'!ENDDEFINE.".
END IF.
EXECUTE.
use
DO IF $casenum=1.
WRITE OUTFILE 'c:\temp\temp.sps' /
"DEFINE !dataname()/" +
"!QUOTE(!CONCAT('C:\TEMP\DATA',#cmonth!,#cday,#cyear,'.sav'))".
!ENDDEFINE.
END IF.
EXECUTE.
*Define the dataname macro:
INCLUDE 'c:\temp\temp.sps'.
* And proceed as before:
*Define dummy data
DATA LIST LIST /var.
BEGIN DATA
1
2
3
END DATA.
*Save file
SAVE OUTFILE = !dataname /COMPRESSED.