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

I have a dataset that has a character variable called date with values
July 7, 2004
June 8,1998
December 14, 2018

How can I convert this to a SAS date without a whole bunch of substrings?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
data have;
input word_date $ 20.;
num_date =input(word_date, anydtdte32.);
format num_date worddate.;
cards;
July 7, 2004
June 8,1998
December 14, 2018
;;;;
run;

Please remember to try and search your questions before posting as well.

https://communities.sas.com/t5/General-SAS-Programming/Converting-character-worddate-format-into-a-d...

 


@Ani7 wrote:

I have a dataset that has a character variable called date with values
July 7, 2004
June 8,1998
December 14, 2018

How can I convert this to a SAS date without a whole bunch of substrings?


 

View solution in original post

1 REPLY 1
Reeza
Super User
data have;
input word_date $ 20.;
num_date =input(word_date, anydtdte32.);
format num_date worddate.;
cards;
July 7, 2004
June 8,1998
December 14, 2018
;;;;
run;

Please remember to try and search your questions before posting as well.

https://communities.sas.com/t5/General-SAS-Programming/Converting-character-worddate-format-into-a-d...

 


@Ani7 wrote:

I have a dataset that has a character variable called date with values
July 7, 2004
June 8,1998
December 14, 2018

How can I convert this to a SAS date without a whole bunch of substrings?


 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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