BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Maisha_Huq
Quartz | Level 8

Hi everyone,

 

****UPDATE:  Would you know how to replace the ":" delimiters in the created_at variable whose values are in the ddmmmyyyy:hh:mm:ss format with an underscore? ****************

 

I have a program which outputs multiple excel files and two emails where the file name has the date (date_pulled).  I need to revise the file names to provide the timestamp as well.

 

Is there a common SAS format, variable which is used for producing timestamps I can use instead? Or would you suggest revising the date_pulled values so it takes out the ":" delimiters from the created_at variable instead of using datepart on the created_at variable?

 

The filenames ar:

<file path>\Liaison QC Report &date_pulled..xml

 

 

Thanks for the suggestions in advance!

--

 

CURRENT CODE:

%macro file_attribs(filename);

%local rc fid fidc;

%global created_at;

%let rc=%sysfunc(filename(onefile,&filename));

%let fid=%sysfunc(fopen(&onefile));

%let created_at=%sysfunc(finfo(&fid,Create Time));

%let fidc=%sysfunc(fclose(&fid));

%let rc=%sysfunc(filename(onefile));

%mend file_attribs;

 

%file_attribs(&path.\&infile..csv);

%put &created_at.;

%let date_pulled = %sysfunc(datepart("&created_at."dt),yymmddn8.);

%put &date_pulled.;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
I think one of the N8601 formats would be appropriate. Or the B8601DT format.

View solution in original post

2 REPLIES 2
Reeza
Super User
I think one of the N8601 formats would be appropriate. Or the B8601DT format.
Maisha_Huq
Quartz | Level 8

Thanks, Reeza! I d used compress and another sysfunc -- this looks great

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 856 views
  • 0 likes
  • 2 in conversation