|
Dear List,
I am using SPSS Production Facility to extract tab-delimited text data
to SPSS on daily basis. The text data file is having naming convention
of NAMEmmddyyy.xls. I have the prompt set up in Production Facility for
'mmddyyyy' in above naming convention.
This process demands for entering date value manually. With the limited
knowledge of macro language I was trying to create a macro for
calculating mmddyyyy from $TIME variable and then I am trying to
concatenate mmddyyyy with file name to generate the right file info.
Below is what I am trying to do :
********************************
*Macro for generating file name 'c:\NAMEmmddyyy'
Define filename()
COMPUTE !monthn = XDATE.MDAY($TIME).
COMPUTE !month = !QUOTE(!monthn).
COMPUTE !dayn = XDATE.MONTH($TIME).
COMPUTE !day = !QUOTE(!dayn).
COMPUTE !yearn = XDATE.YEAR($TIME) .
COMPUTE !year = !QUOTE(!yearn)
COMPUTE !filename = !QUOTE(!CONCAT('C:\NAME',!month,!day,!year)).
!Enddefine.
GET DATA /TYPE = TXT
/FILE = !filename + '.txt'
/DELCASE = LINE
/DELIMITERS = "\t"
/ARRANGEMENT = DELIMITED
/FIRSTCASE = 2
/IMPORTCASE = ALL
/VARIABLES =
Var1 F7.2
Var2 A19
Var3 F10.2
.
CACHE.
EXECUTE.
SAVE OUTFILE = !filename + '.sav'
/COMPRESSED.
**************************************************************
I ran the macro and it game tons of errors (felt like I am abusing macro
facility). I tried manipulating the macro but without any success. Can
anyone please help me solve this problem ??
Thanks in advance,
Vishal.
|