Date: Tue, 22 Nov 2011 12:50:21 -0500
Reply-To: b miner <b_miner@LIVE.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: b miner <b_miner@LIVE.COM>
Subject: Re: Export Contents of Macro Variables
In-Reply-To: <01384B2401936142AF5F65E3D12402780B7F8932@EX3VS1.nyced.org>
Content-Type: text/plain; charset="iso-8859-1"
Thanks! for some reason I needed to put double quotes around the variable to get it not to throw errors about numeric data.
data _null_;
file 'filename.txt';
%DO I=1 %TO &firstCounter;
put "&&IF&I";
%end;
Run;
> Date: Tue, 22 Nov 2011 11:32:37 -0500
> From: YBolotin@SCHOOLS.NYC.GOV
> Subject: Re: Export Contents of Macro Variables
> To: SAS-L@LISTSERV.UGA.EDU
>
> Oh oops, copied from the original code without looking
> Should be "put", not "%put"
>
> Thanks to Ya Huang for the catch
>
>
> -----Original Message-----
> From: Bolotin Yevgeniy
> Sent: Tuesday, November 22, 2011 11:03 AM
> To: b miner; SAS-L@LISTSERV.UGA.EDU
> Subject: RE: Export Contents of Macro Variables
>
> %macro writeToFile();
>
> data _null_;
> file "c:\myfile.txt";
>
> %DO I=1 %TO &firstCounter;
> %put &&IF&I;
> %end;
> Run;
> %mend;
>
>
> If you're having issues with the actual &&IF&I part instead, provide
> more detail.
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of b
> miner
> Sent: Tuesday, November 22, 2011 10:51 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Export Contents of Macro Variables
>
> Hi All-
>
> In a UNIX environment, I wish to write the contents of macro variable
> out to a text file.
>
> The macro variables are indexed and I am accessing them as:
>
> %DO I=1 %TO &firstCounter;
> %put &&IF&I;
> %end;
>
> Is it possible to loop through them and write the value to a text file?
> Each &&IF&I contains a string.
>
> Thanks!
|