Date: Mon, 5 Jan 1998 14:38:10 -0500
Reply-To: "Paul M. Dorfman" <pdorfma@UCS.ATT.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Paul M. Dorfman" <pdorfma@UCS.ATT.COM>
Organization: AT&T UCS
Subject: Re: How to write ?
Content-Type: text/plain; charset=us-ascii
To do just this, PROC PRINT is unnecessary.
First, decide where you want the output. If
it is the log, then simple
will suffice. To skip a line, an empty %put
macro statement can be used. Thus, if if you
submit the following lines:
%LET A = 10;
SAS log will show:
However, this kind of code is usually used rather
to write informational messages into the log than
in report writing. For the latter, DATA step allows
much greater flexibility because it allows you to
choose a position on a line and the file to write.
For instance the step
RETAIN A &A;
PUT @5 A
/ @7 A;
will write 10 at position 5 on the first line, then
go to the next line (because of the slash) and put
10 at position 7 there. An empty PUT statement will
skip a line. If you still want to see the output in
the log, replace PRINT with LOG or just delete the
statement (FILE LOG is the default). Within the
RETAIN statement, &A will resolve to 10, and this
numeric value will be assigned to the DATA step
variable A. In this code, the statement A = &A would
produce the same effect; please read about RETAIN
more to see the possible difference.
There are _lots_ of variations to that tune. To begin
with, read everything about the PUT statement in the
SAS Language Reference or use some introductory user
written books. I'd definitely recommend "SAS Software
Solutions" by Thomas Miron (sorry if I misspelled it).
There is nothing in this book to skip; it teaches using
examples by explaining literally every line of code.
Sorry if it hasn't been a lot of help.
Paul M. Dorfman
AT&T UCS Decision Support Systems
Antonio Wong wrote:
> Hi all,
> I have the following code.
> %LET A=10;
> PROC PRINT;
> TITLE 'A=' &A;
> I just want to write the value of variable A. However, the "PROC PRINT"
> write the most recently used dataset also. I do not want this. I just
> want to print the value of 'A' only. Also, I also want to know how to
> write a line break.
> I hope someone can give a suggestion.
> Thanks and best regards,