Date: Fri, 20 Nov 2009 11:57:39 -0800
Reply-To: Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom Abernathy <tom.abernathy@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: %include statement
Content-Type: text/plain; charset=ISO-8859-1
But you can use a CARDS statement in a datastep generated by a macro
if the CARDS statement is included with the data lines via a %INCLUDE
statement. This example demonstrates generating such an include file
and then using it inside a data step inside a macro.
131 %macro test;
132 data _null_;
133 file tmpfile1;
134 put 'cards4;';
135 do x=1 to 4; put x; end;
136 put ';;;;';
137 run;
138 data test;
139 input x;
140 %inc tmpfile1;
141 run;
142 %mend test;
143 %test;
NOTE: The file TMPFILE1 is:
File Name=/Volumes/scratch/SAS_work137100000E27_gsun81/
tmpfile1.su2,
NOTE: 6 records were written to the file TMPFILE1.
The minimum record length was 1.
The maximum record length was 7.
NOTE: The data set WORK.TEST has 4 observations and 1 variables.
NOTE: DATA statement used:
On Nov 20, 12:55 pm, r...@CDC.GOV ("Fehd, Ronald J. (CDC/CCHIS/
NCPHI)") wrote:
> > From: Joe Matise
> > Subject: Re: %include statement
>
> > I think you aren't supposed to have datalines/cards in %include files.
>
> <sigh> guilt by association:
>
> you cannot have datalines/cards in macros,
> no matter whether they are in-program
> or in separate files which are
> %included files.
>
> Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
> which are %include routine/subroutine