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