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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.