Hi team.
can you please assist with converting a date field from DD/MM/YYYY to YYYY/MM/DD however the data type does not change to date format.
here is my code, however my out put looks like the below
DATA WANT;
SET have;
NEW_DAT = PUT ( INPUT(CREATEDDATE, MMDDYY10.), YYMMDDS10. );
KEEP CREATEDDATE NEW_DAT;
RUN;
please assist
Assuming that the little red A next the variable name in your PHOTOGRAPH of your data indicates that it is already character you should remove part of that function sandwich so that you create an actual numeric date value instead of another character string.
Make sure you read the character string using an INFORMAT that matches the style of date strings that the variable contains. There is no month number 15 so you cannot use the MMDDYY informat.
You can then attach ANY date type format to the variable and SAS will display in the style that format generates.
DATA WANT;
SET have;
NEW_DAT = INPUT(CREATEDDATE, DDMMYY10.) ;
format new_dat yymmdds10. ;
KEEP CREATEDDATE NEW_DAT;
RUN;
Assuming that the little red A next the variable name in your PHOTOGRAPH of your data indicates that it is already character you should remove part of that function sandwich so that you create an actual numeric date value instead of another character string.
Make sure you read the character string using an INFORMAT that matches the style of date strings that the variable contains. There is no month number 15 so you cannot use the MMDDYY informat.
You can then attach ANY date type format to the variable and SAS will display in the style that format generates.
DATA WANT;
SET have;
NEW_DAT = INPUT(CREATEDDATE, DDMMYY10.) ;
format new_dat yymmdds10. ;
KEEP CREATEDDATE NEW_DAT;
RUN;
i have try your code, however am getting the below results
Make sure to use an INFORMAT that can handle the strings. There is no month number 15.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.