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 (January 1998, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 31 Jan 1998 12:36:45 -0500
Reply-To:     HERMANS1 <hermans1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         HERMANS1 <hermans1@WESTAT.COM>
Subject:      Re: assigning date to external file name
Comments: To: TomPBarry <tompbarry@AOL.COM>

If you are trying to read file names and dates from data, then you will need a prior datastep that assigns data values to macrovariable names. You can then construct the filename, assign it to variable in a subsequent datastep, and use the FILEVAR= option of the FILE statement to associate a valid SAS name with an external file. Sig

/*Construct filename filejan1998.01.31 and create file.*/ data stuff; somefile="file"; date=mdy(1,31,1998); call symput('somefile',somefile); call symput('dat',date); run;

%put &dat &somefile;

data null; set stuff; name= "&somefile"||lowcase(put(&dat,monyy7.))||'.'|| put(month(date),z2.)||'.'||put(day(date),z2.); put name=; file fi filevar=name; /* put this 1-7 that 9-10; */ run;

____________________________ Original Question ____________________________ I can't seem to get SAS to create an external data file when using a macro variable. Is it possible to do this another way:

data null; set stuff; file 'some_file'&date put this 1-7 that 9-10; run;

Maybe the output file name would be: filejan1998.01.31

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