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

Hello,

 

I've got some dates that I need to do use in filters and prompts.  They are month end dates stored as a string and they're in the format 0911 = 30 September 2011.  I'm struggling to convert the numbers to dates in a way that doesn't end up as 911 days after 1 Jan 1960.

 

I'm using Enterprise Guide 5.1 and would prefer a solution that I can use in a computed column.  I'd also like to know how to convert this into both Sep 2011 or 30 Sep 2011, I'm not sure which will be most useful at this stage.

 

Thanks! 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User
num_date = input('01'!!char_date,ddmmyy6.);
* now you have the first day of the month;
num_date = intnx('month',num_date,0,'end');
* now you have the last day of the month;

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User
num_date = input('01'!!char_date,ddmmyy6.);
* now you have the first day of the month;
num_date = intnx('month',num_date,0,'end');
* now you have the last day of the month;
paulrockliffe
Obsidian | Level 7

Thanks, that's brilliant!

 

Once I'd remembered that || is concatenate I managed to work out what you were doing.  My problem was that I don't know SAS dates well enough to know whether 0911 can be a valid date, I assumed it could and ran into trouble.  Next time I'll know better!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 980 views
  • 1 like
  • 2 in conversation