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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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