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

Hi All,

 

I am currently working on time based metrics which give me results of over 24 hours and I want to show the result in HH:MM:SS.

 

EVENT_MEASURE_VAL is currently in seconds and I convert it by using the format  TIME. which gives me HH:MM .

How can I format it to show HH:MM:SS

 

Proc Summary data=work.NotReady;
	By WEEK_END_DT;
	VAR EVENT_MEASURE_VAL event_cnt;
Output out=work.notreadyROllUp (DROP=_FREQ_ _TYPE_) SUM=;
RUN;

Data work.notreadyrollupHH;
	Set work.notreadyrollup;
Format event_measure_val time.;
RUN;

Current output

WEEK_END_DT               EVENT_MEASURE_VAL            event_cnt
2017-04-02                                    368100                              651
2017-04-09                                 38908198                        29673
2017-04-16                                38843039                         23754
2017-04-23                                31642259                         20220
2017-04-30                                 29456216                     19358
2017-05-07                              8114040                          14610
2017-05-14                            7851055                            14183

 

Required Output

 

WEEK_END_DT     EVENT_MEASURE_VAL       event_cnt
2017-04-02             102:15:00                                    651
2017-04-09            10807:49:38                                29673
2017-04-16            10789:43:39                               23754
2017-04-23            8789:30:59                                20220

 

 

Regards

 

Dean

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Just give enough space to your time format:

 

data test;
input WEEK_END_DT :yymmdd10. EVENT_MEASURE_VAL event_cnt;
format WEEK_END_DT yymmdd10. EVENT_MEASURE_VAL time20.;
datalines;
2017-04-02 368100 651
2017-04-09 38908198 29673
2017-04-16 38843039 23754
2017-04-23 31642259 20220
2017-04-30 29456216 19358
2017-05-07 8114040 14610
2017-05-14 7851055 14183
;

proc print data=test noobs; run;



PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

Just give enough space to your time format:

 

data test;
input WEEK_END_DT :yymmdd10. EVENT_MEASURE_VAL event_cnt;
format WEEK_END_DT yymmdd10. EVENT_MEASURE_VAL time20.;
datalines;
2017-04-02 368100 651
2017-04-09 38908198 29673
2017-04-16 38843039 23754
2017-04-23 31642259 20220
2017-04-30 29456216 19358
2017-05-07 8114040 14610
2017-05-14 7851055 14183
;

proc print data=test noobs; run;



PG
DME790
Pyrite | Level 9

Thanks PG,

 

I need to stop overthinking SAS.

 

Cheers

 

Dean

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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