i have this date format in excel
RX_DATE |
1/2/2017 |
1/4/2017 |
1/2/2018 |
1/2/2018 |
1/2/2018 |
1/2/2018 |
1/2/2018 |
when i imported to SAS it looked like this and was in character format
RX_DATE |
43626 |
43146 |
43146 |
42826 |
42586 |
used this code to change to numeric and to change in date format
data satratha.TREAT_18;
set satratha.TREAT18;
format rxdate mmddyy10.;
rxdate=input(rx_date, 15.);
run;
and the changed to
RX_DATE |
2/16/2078 |
2/17/2078 |
2/18/2078 |
2/19/2078 |
2/20/2078 |
why 20178 instead of 2018?
Please help me ASAP.
Are you after this?
data char_Date;
input date $;
cards;
43626
43146
43146
42826
42586
;
data want;
set char_Date;
k=intnx('year',input(date,8.),-60,'s')-1;
format k: mmddyy10.;
run;
The answer is very easy t find. Search for:
excel 60 years site:sas.com
and report if anything is unclear
Hi,
43626 |
43146 |
43146 |
42826 |
42586 |
these dates are of 2076 and 2078(in sas format) the numbers which you are seeing are the number of days between jan 1 1960(cutoff date for sas) to whatever dates are these, of 2076 or so.
now coming to your issue. There must be some problem when you are importing your excel file to sas that's why dates are getting disturbed. could you show your code which you are using for importing the data.
FILENAME REFFILE 'filepath/test.xlsx';
PROC IMPORT DATAFILE=REFFILE
DBMS=XLSX
OUT=WORK.IMPORT;
GETNAMES=YES;
RUN;
I used the above code for importing the file and its working fine for me
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: