BookmarkSubscribeRSS Feed
bakara
Calcite | Level 5

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.

8 REPLIES 8
pau13rown
Lapis Lazuli | Level 10

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?

SASKiwi
PROC Star

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.

bakara
Calcite | Level 5

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

SASKiwi
PROC Star

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...

bakara
Calcite | Level 5

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

SASKiwi
PROC Star

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

bakara
Calcite | Level 5

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.

 

SASKiwi
PROC Star

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1409 views
  • 0 likes
  • 3 in conversation