BookmarkSubscribeRSS Feed
myraao
Calcite | Level 5

Someone gave me code a while back with put (_all_) in it. I went to search for another use for it but can't find the documentation. 

 

data _null_;
file "k:\Report_&ryr._Q&qtr._v&rundt..txt" dsd dlm=',';
set out4;
put ( _all_ ) (~);
run;

 

I now know the (~) puts quote marks around all [character?] fields. I found definitions tin Communities about (+0), but I want to know more.

 

Help is appreciated.

4 REPLIES 4
Amir
PROC Star

The documentation can be found in the below link, where it says "How to Group Variables and Formats".

 

_all_, as the name suggests, refers to all variables.

 

When variables are placed in brackets after the put statement then that is referred to a variable-list.

 

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000175758.htm

 

 

Amir.

kwyland1
Fluorite | Level 6

Great information and thanks for the all the specific links to documentation.

I still don't see any mention of the what (:) or (~) etc means.  Can you help?

Tom
Super User Tom
Super User

The documentation of the LIST mode of PUT statement mentions the ~ and : modifiers.

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p0jcwhe1ofmb49n1xf1q2kc44b0v.htm

Although the requirement that you follow the : modifier with a format specification is false.

618  data _null_;
619    set sashelp.class;
620    put name : age;
621  run;

Alfred 14
Alice 13
Barbara 13
Carol 14
Henry 14
James 12
Jane 12
Janet 15
Jeffrey 13
John 12
Joyce 11
Judy 14
Louise 12
Mary 15
Philip 16
Robert 12
Ronald 15
Thomas 11
William 15
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
Tom
Super User Tom
Super User

The _ALL_ is just a variable list.  Just like VAR1-VAR10 or NAME SEX AGE or  FIRST -- LAST or PREFIX: or _NUMERIC_ or _CHARACTER_ etc.. Variable lists are used all over SAS.

https://documentation.sas.com/?docsetId=lrcon&docsetTarget=p0wphcpsfgx6o7n1sjtqzizp1n39.htm&docsetVe...

 

The (varlist) (fmtlist) syntax is part of the PUT statement.  Inside the first parentheses is the list of variables and in the second is the list of formats (and modifiers like ~ or pointer motions like +0).

https://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=n0jks6tlw4a1v1n1ssob6gtpxfth.htm&doc...

 

You can also apply a list of formats to a list of variables in a INPUT statement.

https://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=p0f9yk6pd4znukn1rlw6hzkg1url.htm&doc...

 

If you ever learned FORTRAN it is like the syntax for a READ or WRITE statement.

http://www.math-cs.gordon.edu/courses/cs323/FORTRAN/fortran.html

 

        333    FORMAT(3I4,F8.5,A1,1X,A1,I6)
    
    along with a READ statement,
    
        READ(unit,formatStmtNumber) variableList

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 4 replies
  • 2921 views
  • 0 likes
  • 4 in conversation