In the example given here: http://support.sas.com/kb/24/651.html, what does the following statement do?
put month_name= @;
The trailing @ in the put statement holds the pointer and stops is going to a new line. So in the case in the example in http://support.sas.com/kb/24/651.html the next 'put' statement is written to the same output line to keep all in a row.
This is probably best shown by example:
The original code and output is as follows:
data _null_;
input date :mmddyy8.;
/* Create a new variable */
month_name=PUT(date,monname.);
put month_name= @;
/* or just format the date */
put @25 date @35 date monname.;
datalines;
01/15/04
02/29/04
07/04/04
08/18/04
12/31/04
;
The output to the log is:
month_name=January 16085 January
month_name=February 16130 February
month_name=July 16256 July
month_name=August 16301 August
month_name=December 16436 December
If you remove the trailing '@' from the first 'put' statement using the code below, you'll see how the output differs:
data _null_;
input date :mmddyy8.;
/* Create a new variable */
month_name=PUT(date,monname.);
put month_name= ;
/* or just format the date */
put @25 date @35 date monname.;
datalines;
01/15/04
02/29/04
07/04/04
08/18/04
12/31/04
;
month_name=January
16085 January
month_name=February
16130 February
month_name=July
16256 July
month_name=August
16301 August
month_name=December
16436 December
The following will probably explain it better?
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000161869.htm
Does this help?
regards
David
The trailing @ in the put statement holds the pointer and stops is going to a new line. So in the case in the example in http://support.sas.com/kb/24/651.html the next 'put' statement is written to the same output line to keep all in a row.
This is probably best shown by example:
The original code and output is as follows:
data _null_;
input date :mmddyy8.;
/* Create a new variable */
month_name=PUT(date,monname.);
put month_name= @;
/* or just format the date */
put @25 date @35 date monname.;
datalines;
01/15/04
02/29/04
07/04/04
08/18/04
12/31/04
;
The output to the log is:
month_name=January 16085 January
month_name=February 16130 February
month_name=July 16256 July
month_name=August 16301 August
month_name=December 16436 December
If you remove the trailing '@' from the first 'put' statement using the code below, you'll see how the output differs:
data _null_;
input date :mmddyy8.;
/* Create a new variable */
month_name=PUT(date,monname.);
put month_name= ;
/* or just format the date */
put @25 date @35 date monname.;
datalines;
01/15/04
02/29/04
07/04/04
08/18/04
12/31/04
;
month_name=January
16085 January
month_name=February
16130 February
month_name=July
16256 July
month_name=August
16301 August
month_name=December
16436 December
The following will probably explain it better?
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000161869.htm
Does this help?
regards
David
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.