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.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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