DATA Step, Macro, Functions and more

Date Macro Help

Accepted Solution Solved
Reply
Contributor
Posts: 37
Accepted Solution

Date Macro Help

Hi,

 

I am trying to create an automated time staamp. This is what I have so far:

 

%LET TIME = %SYSFUNC(TIME() );

 

But this isn't giving me what I need. I need 9 digits with no "." in it, for example HHMMSSSSS. Does anyone know how to do that?

 

Thanks.


Accepted Solutions
Solution
‎05-13-2016 10:34 AM
Trusted Advisor
Posts: 1,115

Re: Date Macro Help

Hi @AAWTomHanks,

 

Try this:

%LET TIME = %SYSFUNC(TIME(), b8601tm9.3);

View solution in original post


All Replies
Super User
Posts: 5,260

Re: Date Macro Help

%sysfunc lets you specify a format as a second parameter.

Data never sleeps
Super User
Super User
Posts: 7,413

Re: Date Macro Help

Q1 as normal, why does it need to be a macro?  Macro language is a text generation tool, it has no data structures or means to process data.  Base SAS is there to hold data and process it.  For instance, datastep has a function time(), which can be put into any format, and if need you can strip out any characters you need.  Simple.

 

Solution
‎05-13-2016 10:34 AM
Trusted Advisor
Posts: 1,115

Re: Date Macro Help

Hi @AAWTomHanks,

 

Try this:

%LET TIME = %SYSFUNC(TIME(), b8601tm9.3);
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 210 views
  • 0 likes
  • 4 in conversation