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.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 778 views
  • 0 likes
  • 3 in conversation