Desktop productivity for business analysts and programmers

Create new (date) column by pulling date from Detailed Comment field

Accepted Solution Solved
Reply
Contributor
Posts: 21
Accepted Solution

Create new (date) column by pulling date from Detailed Comment field

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


Accepted Solutions
Solution
‎06-14-2017 12:24 PM
Respected Advisor
Posts: 4,969

Re: Create new (date) column by pulling date from Detailed Comment field

To create a character date, you might try:

 

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

View solution in original post


All Replies
Solution
‎06-14-2017 12:24 PM
Respected Advisor
Posts: 4,969

Re: Create new (date) column by pulling date from Detailed Comment field

To create a character date, you might try:

 

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

SAS Super FREQ
Posts: 676

Re: Create new (date) column by pulling date from Detailed Comment field

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.

Contributor
Posts: 21

Re: Create new (date) column by pulling date from Detailed Comment field

Thank You !

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 100 views
  • 1 like
  • 3 in conversation