BookmarkSubscribeRSS Feed
Pavan_SAS
SAS Employee
data _null_;
input a b;
y = max(a,b);
if _n_ eq 1 then put 'NOTE: A B Y';
put 'NOTE- ' (_all_)(:);
cards;
1 2
3 4
;
run;

what above put statement is doing?
it is displaying the data into log, i know that.
but how, explain?
means i am notable to get what is the meaning of this : 'NOTE- ' (_all_)(:)

thanks,
pavan. Message was edited by: pavan
3 REPLIES 3
GertNissen
Barite | Level 11
The PUT statement enables you to write information that you specify, including text strings and variable values, to the log. Values can be written in column, list, formatted, or named output style.(footnote 1) Used as a screening device, the PUT statement can also be a useful debugging tool. For example, the following statement writes the values of all variables, including the automatic variables _ERROR_ and _N_, that are defined in the current DATA step:

'NOTE- ' is just plain text

_all_ outputs all variables in you data.

(_all_)(:) just means - supress variable names in the output. Try change it to (=); Message was edited by: Geniz
Pavan_SAS
SAS Employee
but, i am notable to see this simple text in the log: 'NOTE- '
i am seeing direct values only. y?

the output in log is:

NOTE: A B Y
1 2 2
3 4 4


from above,
NOTE: A B Y is coming from 1st put i.e., if _n_ eq 1 then put 'NOTE: A B Y';

then wht abt 'NOTE- ' from 2nd put statement? where it is? Message was edited by: pavan
GertNissen
Barite | Level 11
If you in SAS put error, warning or note in the log, it is treated special - ie. different colors.

"NOTE-" equals "don't write the word Note" - put the output is indended.
If you wrote PAVAN- or NOTE+, it would have no special meaning for SAS.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 633 views
  • 0 likes
  • 2 in conversation