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.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1473 views
  • 2 likes
  • 2 in conversation