LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 19 Jul 2005 11:23:47 -0500
Reply-To:   Vishal Dave <VishalDave@Affina.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Vishal Dave <VishalDave@Affina.com>
Subject:   SPSS Macro to combine 'filename' + 'mmddyyy'
Content-Type:   text/plain; charset="US-ASCII"

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.


Back to: Top of message | Previous page | Main SPSSX-L page