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

I am pulling comments that end with a date in the following format MM/DD/YYY and I'm trying to pull the dates to create a separate date column. I tried multiple formulas and I'm still not getting an output.

 

For example:

 

From the comments below, I am trying to pullout the dates:

- 10 Cans of Soda Safeway 05/10/2015

- 3 pounds of Salmon Whole Foods 06/17/2017 

 

One of the formulas I used is the following:

- SUBSTR(RIGHT(INPUT(t1.CommentsPrinted,32.)), 10.) 

 

Any help would be appreciated.

 

Thanks,

 

CJ

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

To create a character date, you might try:

 

scan(t1.CommentsPrinted, -1, ' ')

View solution in original post

3 REPLIES 3
Astounding
PROC Star

To create a character date, you might try:

 

scan(t1.CommentsPrinted, -1, ' ')

BrunoMueller
SAS Super FREQ

Use the SCAN function with a negative index to get the rightmost text and then use the INPUT function with the proper informat to convert the char value to a SAS date value.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 3 replies
  • 731 views
  • 1 like
  • 3 in conversation