BookmarkSubscribeRSS Feed
MZunnurain
Calcite | Level 5
I have an output time from %logparse macro which appears like this in
the csv file....


10:31:34.90 Representing 10 hours 31 minutes 34.90 seconds from the
log


When I open the csv file using Excel it appears like this...


31:34.9 without the 10 hours


when I click on the cell, a format showing as...


10:31:35 AM


Excel took its best guess, but this is not how I would like the time
to appear. I would like it to appear as 10:31:34.90 as in the csv
file. Any ideas? I can reformat myself using hh:mm:ss.000 but as
this will be used for multiple spreadsheets I would like it to be
automatic.
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
When you use ODS CSV to create a report file that Excel can open, you are going to get all the Excel defaults. If you don't like the default format (column width, number format, etc) that Excel uses when it opens the CSV file -- you can use the pull-down menus -inside- Excel to change them.

There is a way to send a Microsoft format from ODS to Excel -- if you use
1) ODS HTML or ODS MSOFFICE2K destinations (HTML-based destinations), then you can use the HTMLSTYLE= style attribute to send an mso-number-format CSS style property to Excel (to use when it opens the HTML file);
2) ODS TAGSETS.EXCELXP destination (Spreadsheet markup language XML based destination) then you can use the TAGATTR= style attribute to send a Microsoft formula or format to Excel (to use when it opens the XML file).

There is a discussion and examples of both techniques in this paper:
http://www2.sas.com/proceedings/sugi28/012-28.pdf

cynthia
MZunnurain
Calcite | Level 5
Thank you Cynthia.

This worked from within ods html....


var realtime / style={htmlstyle="vnd.ms-excel.numberformat:hh:mm:ss.00"};
MZunnurain
Calcite | Level 5
Now if I could just get logparse to tell me data what? or sort what?
or sql what?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 795 views
  • 0 likes
  • 2 in conversation