proc sql generate timestamp

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 133
Accepted Solution

proc sql generate timestamp

Hi SAS Experts,

I need to create an XML file that has a unique ID every time I generte it.

The data fo create the XML is extracted from a sas data set using proc sql and now I wonder

how to generate a unique timestamp, preferable something just numbers.

 

proc sql;
    create table VDR as
    select
%sysfunc(datetime(),datetime18.)
from sashelp.class;
    run;

 

Any ideas?


Accepted Solutions
Solution
‎05-03-2016 10:16 AM
Contributor
Posts: 20

Re: proc sql generate timestamp

Hi,

 

proc sql;
select *, put(datetime(),datetime18.) as timestamp from sashelp.class;
quit;

 

Regards,

Manohar

View solution in original post


All Replies
Solution
‎05-03-2016 10:16 AM
Contributor
Posts: 20

Re: proc sql generate timestamp

Hi,

 

proc sql;
select *, put(datetime(),datetime18.) as timestamp from sashelp.class;
quit;

 

Regards,

Manohar

Super User
Posts: 5,382

Re: proc sql generate timestamp

Why store it as char? Use format=datetime 18

Also, using automatic macro variable may be more efficient than using functions:
"&sysdate:&systime"dt
One drawback with thus this will only give you the minute.
Data never sleeps
☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 342 views
  • 3 likes
  • 3 in conversation