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.
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.
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?
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
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.
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).
You can also apply a list of formats to a list of variables in a INPUT statement.
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
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.