BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

I've a code like below. When I run this code, I get date field as string in .xml. However I need as numeric in .xml. Kindly someone give insights to achieve dateric this task. I use SAS 9.3.

data log_table;

retain fname1 Date_TimeStamp1 Date  Status processid1 userid1 Details;

set log_analysis;

fname1=scan(filename,-1,'/');

processid1=compress(Processid,,'kad');

if userid = : ':' then userid1=substr(userid,2);

else userid1=userid;

Date_TimeStamp1=input(Date_TimeStamp,E8601DT24.3);

Date=input(Date_TimeStamp,E8601DT24.3);

/*Date=input(Date_TimeStamp,date9.);*/

format Date_TimeStamp1 datetime21.2;

format date e8601dn.;

drop processid userid filename Date_TimeStamp;

run;

proc export data=log_table outfile='/usr/sas/tir/work/log_table.csv' dbms=csv replace;

run;

ODS tagsets.excelxp file='/usr/sas/tir/work/log_table.xml' style=statistical

  options(autofilter='ALL'  sheet_name='log_analysis'  sheet_interval='none' embedded_titles='Yes');

  title;

title1 'Log Analysis Report';

proc Report data=log_table box nowd missing out=work.log_table_final

  style(header) = {background=white foreground=black FONT_WEIGHT = bold bordertopcolor=black borderleftcolor=white

  borderrightcolor=white borderbottomcolor=black};

  columns fname1 Date_TimeStamp1 date  Status processid1 userid1 Details;

  define fname1/style(header)=[background=lightgreen] width =45  display;

  define Date_TimeStamp1/"Date Timestamp1" style(header)=[background=lightgreen] width =16  display;

  define Date/style(header)=[background=lightgreen] width=16 display;

  define Status/ style(header)=[background=lightgreen]  width =5 display;

  define processid1/ style(header)=[background=lightgreen] width =10  display;

  define userid1/ style(header)=[background=lightgreen] width =20  display;

  define Details/style(header)=[background=lightgreen] width =60  display;

run;

ods tagsets.excelxp close;

ods listing;

ods listing close;

2 REPLIES 2
ballardw
Super User

What is that numeric value going to represent?

The numeric value SAS uses for a datetime variable is the number of seconds since Midnight 1/1/1960.

Please provide an example of what that number should look like.

Peter_C
Rhodochrosite | Level 12

Which version of the tagset is reported in the saslog?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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