BookmarkSubscribeRSS Feed
Hb21Pzn
Calcite | Level 5

HI,

 

I will be really gratefull for help, because after three days I have run out of ideas.

I would like to present ending times of some processes on timeseries plot in VA (must be dashboard).

X axis should be the date (here everything is fine) and Y axis should be the corresponding time. 

Unfortunetelly I am not able to do that without converting time format to numeric (only one way to convert time to measure and implement that on plot) which is not good enoough to present.

 

So the thing is that I have an idea to convert time format variable to integer, but not like normal amount of second from 00:00:00.

 

Rather like below:

      

                08:37:23 (time format) --> 83723 (numeric) --> 8:37:23 (numeric with colon as decimal)

 

After carying out these steps and load data into lasr everythig should work, but i can't convert  time data properly in last transformation.

I am putting code below which partialy doing what i want, but colon is not on right places. At least is numeric and has colon, so it must be possible 🙂

 


proc format library=work;
picture mysep

0 - 999999 = '000:000:00' (decsep=':' dig3sep=':');
run;

 

data test;
x= 123456;
format x mysep.;
run;

 

Thank you very much for your help.

 

Regards,

Hubert

3 REPLIES 3
PaigeMiller
Diamond | Level 26

@Hb21Pzn wrote:

HI,


Unfortunetelly I am not able to do that without converting time format to numeric (only one way to convert time to measure and implement that on plot) which is not good enoough to present.



Explain! This is usually good enough for most people.

 

Rather like below:

      

                08:37:23 (time format) --> 83723 (numeric) --> 8:37:23 (numeric with colon as decimal)


The mistake you are making is assuming that time is a character string of some sort. It is not. It is a numeric. It is being shown to you as 08:37:23, but it is really the number of seconds since midnight. This works fine in almost any application I can think of. Converting this number to something else is the wrong thing to do. Leave it as a number, and plot it on your Y axis, with the proper format (whatever time format you like), and that will work.

 

--
Paige Miller
ballardw
Super User

TIME in SAS is measured in SECONDS. Since hours=60 minutes and a minute is 60 seconds the value 83723 has NO connection as far as SAS is concerned with 8:37:23.

data _null_;
   x=hms(8,37,23);
   put "x as number of seconds: " x= +1 "X with a time format: " x= time8.;
run;

 

Your code shows NO attempt to "convert" anything. So I am not sure what you think you are attempting.

 

A simple time format for time values should work for most purposes.

If you want the VA way of doing things, then post the question in the Visual Analytics part of the forum. You should also describe exactly how and why "Unfortunetelly I am not able to do that without converting time format to numeric (only one way to convert time to measure and implement that on plot) which is not good enough to present."

 

By any chance are your "times" actually datetime values? You might need to extract the date and time portions with the DATEPART and TIMEPART functions to create your X and Y variables. It would then still be a good idea to use Time and one of the date formats for the resultant variables.

Hb21Pzn
Calcite | Level 5

I know everything about that what you are saying regarding times:) I am trying to find any agile sollution which would give me any acceptable view on visualization in VA. This one unforunetely doesn't work... I will open new ticket, because I have realized that is not good group. Thank you very much.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 696 views
  • 0 likes
  • 3 in conversation