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
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.