BookmarkSubscribeRSS Feed
stat_sas
Ammonite | Level 13

Try this for the desired output.

Thanks,

proc sql;

create table want as

select * from TABLE_A,TABLE_B

where Field_B contains strip(Field_A);

quit;

Ksharp
Super User

CODE NOT TESTED.

proc sql;

create table want as

select *

from A,B

  where Field_B contains strip(Field_A  )  ;

quit;

Xia Keshan

podarum
Quartz | Level 8

Thanks all.. it worked perfectly.

podarum
Quartz | Level 8

Can anyone help with what I'm doing wrong here (below), I'm basically trying to create 2 new fields if the match criteria happens with Mortgage_Number_3 and another with Mortgage_Number_5.  Put a 1 if match and a 0 if not..  thanks

proc sql inobs=100;

create table ABC.TEST_ME_2011_3 as

select a._ID, b.Mortgage_Number_3

from ABC.New_claims_jun10 b, KY.Loan_default_prep30nov2011 a

where a.AR_ID contains strip(b.Mortgage_Number_3) then  1 else  0 as short

where a.AR_ID contains strip(b.Mortgage_Number_5) then  1 else  0 as long;

quit;

stat_sas
Ammonite | Level 13

Use case statement in select portion of the query to create new variables based on some condition

case when a.AR_ID contains strip(b.Mortgage_Number_3)  then 1 else  0 end as short

case when a.AR_ID contains strip(b.Mortgage_Number_5)  then 1 else  0 end as long

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 19 replies
  • 6663 views
  • 0 likes
  • 9 in conversation