Hi,
I have used proc import a time variable from Xlsx and it turns into a character variable.
For example
In xlsx
Occ_Time |
9/22/2016 9:00 |
9/22/2016 9:00 |
9/22/2016 9:00 |
9/22/2016 9:00 |
9/22/2016 12:00 |
After proc import. The variable becomes Character and the value are
Occ_Time
42635.375
42635.375
42635.375
42635.375
42635.5
I need to learn how to correct it in my SAS data set.
Thank you.
Thank you all for your help. I have found an article and be also to convert Excel date to SAS date and then present it in a format of datetime16.
In brief,
SAS_date_time=(Excel_date_time-21916)*86400.
Here is that article.
https://support.sas.com/resources/papers/proceedings/proceedings/sugi29/068-29.pdf
date_wanted = datepart(Occ_time);
Like this?
data tr;
XLS_DATE=42635.375;
SAS_DATE=intnx('year',int(XLS_DATE),-60,'s')-1;
putlog SAS_DATE= date9.;
run;
SAS_DATE=22SEP2016
SAS dates start on 01JAN1960, Excel dates start on 01JAN1900.
Thank you all for your help. I have found an article and be also to convert Excel date to SAS date and then present it in a format of datetime16.
In brief,
SAS_date_time=(Excel_date_time-21916)*86400.
Here is that article.
https://support.sas.com/resources/papers/proceedings/proceedings/sugi29/068-29.pdf
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.