sas - How to add a LIKE statement or INDEX function in the IN statemeng using PROC SQL -


i use below code create indicator 0 if values in code not found in record of table , 1 if pertinant values match record on table.

proc sql; create table test select id       ,a.company_yr in (select company_yr table2)                            , a.industry in (select industry table2)                           , a.sector in (select sector table2) match_ind work.table1 a; quit;   

my problem company_yr, industry , sector aren't perfect match because of abbreviations or other mix ups in data (e.g., 'ford motors' in table1 , 'ford' in table2). need way use statement or index statement in conjunction trim statement allow me match parts of string make indicator more accurate. haven't been able find way accomplish yet.

try replace "strip()" function whatever want accomplish desired normalization, perhaps nested "compress()" functions, , "upcase()" fun. turn equality in subquery like, it's not clear you'd match on.

proc sql; create table test select     id,     exists (select 1 work.table2 b             strip(a.industry) = strip(b.industry)             , strip(a.sector) = strip(b.sector)     ) match_ind work.table1 a; quit; 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -