I have attached a sample dataset.
I can get the date format in date9. in data step.
DATA SAMPLE1;
FORMAT SAMPLE_DT1 DATE9.;
SET SAMPLE;
SAMPLE_DT1 = DATEPART(SAMPLE_DT);
RUN;
May i know how to get similar answer in PROC SQL? I used datepart in SQL but could not get it. Any idea? Thanks.
Try this one:
PROC SQL;
SELECT * , DATEPART(SAMPLE_DT) AS SAMPLE_DT1 FORMAT=date9.
FROM sample;
quit;
Try this one:
PROC SQL;
SELECT * , DATEPART(SAMPLE_DT) AS SAMPLE_DT1 FORMAT=date9.
FROM sample;
quit;
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.