06-07-2018 04:07 AM
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:
06-08-2018 10:53 PM
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?
06-09-2018 06:10 PM
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.
06-10-2018 07:10 AM
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.
06-10-2018 08:23 PM
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:
06-11-2018 08:22 AM - edited 06-11-2018 08:41 AM
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
06-12-2018 04:26 AM
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.