Hi,
The below table generates 'Date_Of_Birth' as a date output of DDMMYY and I need YYYMMDD, can anyone help please?
Thanks
proc sql;
create table table_b as select
Account_Number as Number,
FIRST_NAME_TEXT,
SURNAME_TEXT,
Date_Of_Birth
from table_a;
quit;
@NewToAllThis wrote:
This is working to rearrange the numbers but I needed separators sorry, so I need it to be YYYY/MM/DD 🙂
Spelling counts. The YYMMDDS10. format will add slash The YYMMDDx has several characters that replace the X to change delimiters.
If your source table is actually a SAS data set and the value is a SAS date value, i.e. numeric with the SAS format ddmmyy8 or similar applied all you need is to change the existing format.
proc sql; create table table_b as select Account_Number as Number, FIRST_NAME_TEXT, SURNAME_TEXT, Date_Of_Birth format=yymmddn8. from table_a; quit;
If you actually want a 3-digit year value though you will have to roll your own and likely have all sorts of fun.
If your table is not SAS or your value is character or plain numeric, ie. 301112 with a format like Best or f6. then we need more details as you need to create the SAS date value.
The date format it is stored in is DATE9. and I need it to read yyyy/mm/dd. Sorry I missed out a Y earlier 😞
proc sql;
create table table_b as select
Account_Number as Number,
FIRST_NAME_TEXT,
SURNAME_TEXT,
Date_Of_Birth format=yymmdd8.
from table_a;
quit;
@NewToAllThis wrote:
This is working to rearrange the numbers but I needed separators sorry, so I need it to be YYYY/MM/DD 🙂
Spelling counts. The YYMMDDS10. format will add slash The YYMMDDx has several characters that replace the X to change delimiters.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.