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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register 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.

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
  • 19 replies
  • 1449 views
  • 0 likes
  • 9 in conversation