SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DmytroYermak
Lapis Lazuli | Level 10

 

 Hi all,

 

Could you please explain what 

 

  put (_all_) (+0);

means in the code:

 

data _null_;
  file 'cars_noheader.csv' dsd ;
  set sashelp.cars;
  put (_all_) (+0);
run;

Thank you!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

_all_ is a keyword that gives you all variables present in the PDV.

If you use _all_ without anything else, you get a list including automatic variables in this form:

Make=Acura Model=MDX Type=SUV Origin=Asia DriveTrain=All MSRP=$36,945 Invoice=$33,337 EngineSize=3.5 Cylinders=6 Horsepower=265
MPG_City=17 MPG_Highway=23 Weight=4451 Wheelbase=106 Length=189 _ERROR_=0 _N_=1

If you add the "pseudo-format-specification-with-pointer-control" +0 to all the variables (that's why you need the brackets), you get this:

Acura MDX SUV Asia All $36,945 $33,337 3.5 6 265 17 23 4451 106 189

I got this by applying Maxim 4 and running this code:

data _null_;
  set sashelp.cars (obs=1);
  put (_all_) (+0);
run;

data _null_;
  set sashelp.cars (obs=1);
  put _all_;
run;

and inspecting the log.

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

_all_ is a keyword that gives you all variables present in the PDV.

If you use _all_ without anything else, you get a list including automatic variables in this form:

Make=Acura Model=MDX Type=SUV Origin=Asia DriveTrain=All MSRP=$36,945 Invoice=$33,337 EngineSize=3.5 Cylinders=6 Horsepower=265
MPG_City=17 MPG_Highway=23 Weight=4451 Wheelbase=106 Length=189 _ERROR_=0 _N_=1

If you add the "pseudo-format-specification-with-pointer-control" +0 to all the variables (that's why you need the brackets), you get this:

Acura MDX SUV Asia All $36,945 $33,337 3.5 6 265 17 23 4451 106 189

I got this by applying Maxim 4 and running this code:

data _null_;
  set sashelp.cars (obs=1);
  put (_all_) (+0);
run;

data _null_;
  set sashelp.cars (obs=1);
  put _all_;
run;

and inspecting the log.

DmytroYermak
Lapis Lazuli | Level 10

Thank you for the quick response and the explanations! It is very useful.

Kurt_Bremser
Super User

I have to say that I could not find a specific reference to the behaviour of _all_ with the modifier in the documentation of PUT. Only the named list output of _all_ without the modifier is documented.

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1907 views
  • 2 likes
  • 2 in conversation