Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

Time field as a measure

Reply
New Contributor
Posts: 4

Time field as a measure

I have Sas va 7.4
When I import a database, it defaults placing the time field as a category and not as a metric. How do I change this while maintainin

my hourly format?

 

An example of what I am trying to produce:

 

Ex.JPG

Thank you.

Regular Contributor
Posts: 170

Re: Time field as a measure

what makes you say sas is treating it as a categorical variable? does it appear as a character variable? is sas throwing an error when you use eg proc univariate?

--------------
blog: papersandprograms.com
Super User
Posts: 4,018

Re: Time field as a measure

Check your data source. Is the time field defined as character? That would explain why VA is treating it as a category.

 

How are you importing from the database and what is the database? The best solution is to get the import working correctly so the time field is defined as a numeric with a SAS time format.

New Contributor
Posts: 4

Re: Time field as a measure

Hi,

 

My import process is pretty simple. I created an example for you to see. I created 2 columns database with "Enter" column that is defined as time (you can see in the picture). Next, I export it to LocalData Folder as SAS file (sas7bdat). Then, i imported it to VA.

 

VA sees it as an hour as it should but im unable to change is to measure.

Please see attached pictures.

 

First1.pngSecond.png

Super User
Posts: 4,018

Re: Time field as a measure

OK, it appears date and time fields are treated as type category and you can't change this. However you can derive measures from these as explained in this post:

https://communities.sas.com/t5/SAS-Visual-Analytics/Summarizing-time-columns-in-the-VA/m-p/302151/hi...

New Contributor
Posts: 4

Re: Time field as a measure

[ Edited ]

Hi,

 

i copied the solution from the post you gave me (I took from the last replay)

 

IF ( Sum [_ByGroup_] ('timeSec'n) <= 3600 )

RETURN ( Floor(( Sum [_ByGroup_] ('timeSec'n) / 60 )) + ( ( Sum [_ByGroup_] ('timeSec'n) Mod 60 ) / 100 ) )

ELSE ( ( Floor(( Sum [_ByGroup_] ('timeSec'n) / 60 )) + ( ( Sum [_ByGroup_] ('timeSec'n) Mod 60 ) / 100 ) ) / 60 )

 

 

This solution isn't good enough because in some cases the minutes are over 60 as you can see in the picture bellow

 

Upload.png

Super User
Posts: 4,018

Re: Time field as a measure

What happens if you format the calculated measure as hours, minutes, seconds?

New Contributor
Posts: 4

Re: Time field as a measure

It's going back to category.

 

No matter what I do, if I'm using time format in a calculation its going back to category.

 

I got an answer from SAS that it's impossible to use time (in time format) as a measure in VA 7.4

 

8.2 Version is more flexible and it can be done. Bottom line, I need to upgrade my VA.

 

Super User
Posts: 4,018

Re: Time field as a measure

Luckily we don't use times on our VA 7.4, and good to hear 8.2 (and soon 8.3) deals with times better.

Ask a Question
Discussion stats
  • 8 replies
  • 250 views
  • 0 likes
  • 3 in conversation