put (_all_) (=)

[last updated - 08 September 2007]

Introduction

You will certainly be familiar with the "put" statement that you use in data steps. You have probably used the "put _all_=;" statement to put out a list of all your dataset variable names with their values but what about "put (_all_) (=);"? If you have easy access to sas then try out "put _all_=;" and compare it with what you get with "put (_all_) (=);". If you do this then you will probably notice that there is no _ERROR_= and _N_= in the list of variables in the second case. Why should that be?

put (_all_) (=) explained

"put" can work with lists of variables and lists of formats. The list of variables goes in round brackets followed by the list of formats, again in round brackets. So what the "(_all_)" gives you is a list of all the variables in the dataset (not including the automatic variables) and the "(=)" sign says to use the equals sign after each variable in the list. The result is the same as what you get with "put _all_=" but without the automatic variables.

Put Statement, Formatted

There are many forms of the humble "put statement". Using a "put" statement in the form "put (_all_) (=)" falls under the title "Put Statement, Formatted" that you can read about in the sas documentation. I'll let you look that up for more details but once you know about this you will find yourself using this technique for putting values to the log in a more convenient form, especially when you are debugging code.
 


 

Go back to the home page.

E-mail the macro and web site author.