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?


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 736 views
  • 0 likes
  • 2 in conversation