Date: Tue, 26 Jul 2005 10:10:10 +0000
Reply-To: Guido T <cymraeg_erict@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Guido T <cymraeg_erict@HOTMAIL.COM>
Subject: Re: Rearranging %PUT in the Log?
In-Reply-To: <1122325384.025097.22180@g14g2000cwa.googlegroups.com>
Content-Type: text/plain; format=flowed
>From: my_sas_spot@YAHOO.COM
>Reply-To: my_sas_spot@YAHOO.COM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Rearranging %PUT in the Log?
>Date: Mon, 25 Jul 2005 14:03:04 -0700
>
>In SAS Help (for 9.1.3), the following is the first example for the
>%PUT definition:
>
>Example 1: Displaying Text
>The following statements illustrate using the %PUT statement to write
>text to the SAS log:
>
>%put One line of text.;
>%put %str(Use a semicolon(;) to end a SAS statement.);
>%put %str(Enter the student%'s address.);
>
>When you submit these statements, these lines appear in the SAS log:
>
>One line of text.
>Use a semicolon(;) to end a SAS statement.
>Enter the student's address.
>
>===================================================================
>
>In actuality, when I run those 3 %put statements, I get the following:
>
>2929 %put One line of text.;
>One line of text.
>2930 %put %str(Use a semicolon(;) to end a SAS statement.);
>Use a semicolon(;) to end a SAS statement.
>2931 %put %str(Enter the student%'s address.);
>Enter the student's address.
>
>Is there a way to get them all together with all the %put statements
>together and the results together? For example, what I would like is a
>block of code in the log (or better yet, in the listing) which looks
>like this:
>
>MACRO VARIABLES;
>===============;
>acount = 100000;
>ascore = 0.45;
>smean1 = 0.4;
>smean2 = 0.5;
>
>But I know the following code won't produce it:
>
>%put MACRO VARIABLES;
>%put ===============;
>%put acount = &acount;
>%put ascore = &ascore;
>%put smean1 = &smean1;
>%put smean2 = &smean2;
>
>
>What will? Is it even possible? Is there an option statement I can
>include?
>
>Thanks.
>Myra
Hi Myra,
Try the following to get the macro vars listed ...
data _null_;
length mnam $8 mval $80;
file print;
put "MACRO VARIABLES" /
"===============";
do mnam ="acount","ascore","smean1","smean2";
mval = symget(mnam);
put mnam " = " mval;
end;
run;
Using a datastep gives a bit more control over the output.
HTH
++ Guido
|