Date: Fri, 19 Nov 1999 12:22:13 -0500
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: macro ARGS
Content-Type: text/plain; charset="iso-8859-1"
I have been solving my own problem:
%*USAGE: %ARGS(<fileref>)
%ARGS(<fileref>,PRINT=LOG);
%MACRO ARGS(FILENAME,PRINT=PRINT);
data _null_;
file &PRINT.;
retain OpenCmnt 1
MacParms 0;
do until(EndoFile);
infile "&FILENAME."
end = EndoFile
pad lrecl=72;
input @1 Line $char72.;
if index(Line,'%MACRO') then do; MacParms = 1;
OpenCmnt = 0; end;
if OpenCmnt or MacParms then put Line;
if MacParms and index(Line,';') then MacParms = 0;
%*..................................................;end;
stop;
run;%*...............................................;%MEND;
%ARGS(r:\data\mpep\sasmacro\ARRAY.sas);
I would like to use a fileref of the form
infile SASAUTOS(&FILENAME) ...;
but error messages prompt me to add the extension .sas
infile SASAUTOS(&FILENAME..SAS) ...;
but then I get ...ARRAY.SAS.DAT not found.
As you can see I have had to modify the macro to require a fully-qualified
fileref.
So now I'm just reading any file, rather than reading any macro stored in
SASAUTOS
Anyone know how to get around the assumption of .dat in the infile statement
when referring to a member in a directory?
Which is, of course, why I wanted to add the option LINES= to the %include
statement
so I could use it thus:
%INCLUDE SASAUTOS(ARRAY) /source2 lines=50;
Ron Fehd the macro maven CDC Atlanta GA