Text mining and content categorization

Extracting numbers embedded in text

Reply
Occasional Contributor
Posts: 5

Extracting numbers embedded in text

Does anyone out there have code to share that will help me to extract numbers out of a character variable that may or may not have numbers embedded in the observation?

Specifically, I just need to extract the street number out of a variable that contains the street address but no guarantee where the street number is embedded in the string or how many digits there are.

Thanks, in advance, for any help!

Respected Advisor
Posts: 3,834

Re: Extracting numbers embedded in text

Posted in reply to gwcanalytics

Start with ANYDIGIT function and work from there.

Occasional Contributor
Posts: 5

Re: Extracting numbers embedded in text

Posted in reply to data_null__

Thank you!  This was very helpful to get me started.

Super User
Posts: 22,874

Re: Extracting numbers embedded in text

Posted in reply to gwcanalytics

compress with kd option is also useful.

Respected Advisor
Posts: 3,834

Re: Extracting numbers embedded in text

What will COMPRESS KD give for "123 West 23rd"?

Ask a Question
Discussion stats
  • 4 replies
  • 546 views
  • 8 likes
  • 3 in conversation