DATA Step, Macro, Functions and more

Search an address variable for a specific value/variable value

Accepted Solution Solved
Reply
Contributor
Posts: 26
Accepted Solution

Search an address variable for a specific value/variable value

[ Edited ]

Hi ,

I have to search the variable a in variable b

 

 

Example variable a                             variable b

              "North Carolina"                 Wake Forest University Conference Center, 200 North College Street, Charlotte, North Carolina |          
                                                          Room 113

 

 

if yes then create a flag.

 

Help?

 


Accepted Solutions
Solution
‎07-13-2017 10:45 AM
Super User
Posts: 19,815

Re: Search an address variable for a specific value/variable value

@sdixit please use descriptive titles. BASE SASE is uninformative and will not help future users searching for a similar solution. 

 

As indicated above you can use either 

 

INDEXW or FINDW to find a phrase in another piece of text. 

Look at the examples in the documentation:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212235.htm

 

 

 

View solution in original post


All Replies
Super User
Posts: 7,786

Re: BASE SAS

Use the index() function.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 11,343

Re: BASE SAS

Is Variable A always a State name? Do you have a requirement to match Variable A = "North Carolina" to NC in  variable B?

Or NC in Variable A to "North Carolina" in Variable B?

Solution
‎07-13-2017 10:45 AM
Super User
Posts: 19,815

Re: Search an address variable for a specific value/variable value

@sdixit please use descriptive titles. BASE SASE is uninformative and will not help future users searching for a similar solution. 

 

As indicated above you can use either 

 

INDEXW or FINDW to find a phrase in another piece of text. 

Look at the examples in the documentation:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212235.htm

 

 

 

☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 151 views
  • 0 likes
  • 4 in conversation