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
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.