BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
scb
Obsidian | Level 7 scb
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Kalind_Patel
Lapis Lazuli | Level 10

Try this one:

PROC SQL;
SELECT * , DATEPART(SAMPLE_DT) AS  SAMPLE_DT1 FORMAT=date9.
FROM sample;
quit;

View solution in original post

1 REPLY 1
Kalind_Patel
Lapis Lazuli | Level 10

Try this one:

PROC SQL;
SELECT * , DATEPART(SAMPLE_DT) AS  SAMPLE_DT1 FORMAT=date9.
FROM sample;
quit;
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1102 views
  • 0 likes
  • 2 in conversation