BookmarkSubscribeRSS Feed
SIgnificatif
Quartz | Level 8

Hi all.

I would like to ask you about search patterns in text ?

how to search for a particular keyword : left private home or left side private home
1) between keyword1 'title:' X and keyword2 'builder :'
1A) if found , assign a value home=left private
2) skip text in middle and search after the keyword more information:
for left floor1 or left 1floor  ( sometimes written 1floor or floor1)
2A) if found , assign to the variable: SIDE the value left ( or right) and the value 1floor to the variable floor  ( the number of flours could vary from 0 to 10)
here is the text for example:

and  ( if possible)..
3) if in the first task home=left private and SIDE = right (missmatch of sides ..) add a mention to the variable missmatch=problem

Hello this is some text

title : great news here    <-- first part of the exercise 
new beautiful left private home  <-- this is the scope to start with

builder: 
a new company constructed the home 

blablbablablbablablbablablbablablba
some text .....

for more information: 
you can contact to acquire left floor1 Mr. smith, or Mr John

I'm trying to figure out how to use RE and internal SAS F to search for text...that is in variables, I'll have to put all in a loop afterwards..


Thank your response

 

2 REPLIES 2
ballardw
Super User

Please clearly indicate which are key words. I am not sure if the word is a single word and what it may be or you want to use a phrase

Your subject says "search for a word between two words" , so which are the exact two words searched between???

Example:

how to search for a particular keyword : left private home or left side private home

Is "left private home" a key phrase searching for? or is the OR what you are searching for?

 

And providing examples of the text to search in and showing what the actual results look like.

SIgnificatif
Quartz | Level 8
Thank you for your precision, the kw to search is 'left private home' or 'left side private home' ( not the or, the or is a condition), it must be searched BETWEEN the green text, for the other part, it must be searched AFTER the blue text

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

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