I exported excel file to sas, ex: for some reason date in excel is ddmmmyyy (15oct2020) converted to character days variable (41250, character) how I can bring it back to 15oct2020 in my proc report.
excel date=15oct202-
sas dataset=41250- character variable
I want in proc report as 15oct2020
The best solution is to fix the Excel file so the column with the date values does not have any cells with strings instead of dates. Then SAS won't have to convert the numbers to character strings.
Otherwise convert the string to a number and adjust for the difference in how SAS and Excel count days.
sas_date = input(excel_string,32.) + '30DEC1899'd ;
format sas_date date9.;
Correction its imported from excel to SAS
The best solution is to fix the Excel file so the column with the date values does not have any cells with strings instead of dates. Then SAS won't have to convert the numbers to character strings.
Otherwise convert the string to a number and adjust for the difference in how SAS and Excel count days.
sas_date = input(excel_string,32.) + '30DEC1899'd ;
format sas_date date9.;
Thanks a lot it worked.👍👍. Just curios if I want display it as 08-aug-2019, i need use date 11.?
sounds great, it worked in both, I am fine with AUG capitals. Thanks.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.