BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
I have this at the end of a sas file

Data_null_;
file ”&G_IFC_PATH/DATA/WDATA/cmsdate.txt”;
cmsdate=put(compress(put(&acdt,yymmdd10.),’-’),8.):
put @1 cmsdate $8.;
run;

What does this do? Since no output dataset or temp dataset saved, does it changing the content of txt file? Does variable cmsdate still exist in the system after this program is run?
2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Line by line.

 

The File Statement specifies the output file for the Put Statements to come. 

 

file ”&G_IFC_PATH/DATA/WDATA/cmsdate.txt”;

 

This seems to put the &acdt macro variable into some desired format (I can't see &acdt).

 

cmsdate=put(compress(put(&acdt,yymmdd10.),’-’),8.):

 

This Put Statement puts the value of cmsdate in the first column in the file you specified in the File Statement.

 

put @1 cmsdate $8.;

 

japelin
Rhodochrosite | Level 12

I recommend to review the documentasion first.

https://documentation.sas.com/doc/en/lrcon/9.4/n0elquksqmdambn11jprcl6d1fxw.htm#n1q67b96axz10dn14y1p... 

 

> What does this do? Since no output dataset or temp dataset saved, does it changing the content of txt file?

The text file is rewritten because it is put into the file specified in the file statement.

 

> Does variable cmsdate still exist in the system after this program is run?

No dataset is generated, so no variables exist.

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 445 views
  • 0 likes
  • 3 in conversation