BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mikepark
Obsidian | Level 7

I know that automatic variables are dropped at the end of the data step. Is there a way to see it though? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data _null_;
 set sashelp.class;
 put _all_;
run;

View solution in original post

5 REPLIES 5
novinosrin
Tourmaline | Level 20

Write to the log using put/putlog or assign the value to a new variable

Astounding
PROC Star

A few ways.

 

You can add a PUT statement within the DATA step:

 

put first.state;

 

Or you can copy the variable to a different DATA step variable:

 

auto1 = first.state;

auto2 = last.state;

auto3 = eof;

auto4 = _n_;

 

Then you will have this new set of variables available in the output data set.

 

If you ask a more specific questions, you can get a more specific answer.

ghosh
Barite | Level 11
* From  a blog by Rick Wicklin ; 
%put _AUTOMATIC_;
%put _USER_;
gamotte
Rhodochrosite | Level 12
Not that "%put _AUTOMATIC_;" gives the values of automatic *macro* variables.

You can use
put _ALL_;
to print the values of all variables, including automatic variables, available in your data step.
Ksharp
Super User
data _null_;
 set sashelp.class;
 put _all_;
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 1203 views
  • 5 likes
  • 6 in conversation