BookmarkSubscribeRSS Feed
Sandy10
Calcite | Level 5

Hi.

 

The below code retreives blank value in ACCOUNT_NUMBER field. Not sure where its going wrong.

The variables which are not in ABC and available in DEF (ACCOUNT_NUMBER,UPDATE_WHEN_PMT_CD_AUTO_CHANGE etc) are blank . I want ACCOUNT_NUMBER to be populated. Kindly advise. Thanks.

proc sql noprint;
create table TEMP as
select *
FROM ABC  a left join (select *
FROM DEF b
where b.RATE_EFFECTIVE_DATE > ( select distinct reporting_date from ABC  )
and b.reporting_date = ( select distinct reporting_date from ABC  )
and UPCASE(strip(UPDATE_WHEN_PMT_CD_AUTO_CHANGE)) = 'N') c
on a.ACCT_NUMBER = c.Account_Number;

quit;

 

1 REPLY 1
PGStats
Opal | Level 21

I think your query should read:

 

proc sql;

create table TEMP as
select a.*, b.*
FROM 
    ABC as a left join 
    (   select * from DEF 
        where upcase(strip(UPDATE_WHEN_PMT_CD_AUTO_CHANGE)) = 'N')
     as b on 
        a.ACCT_NUMBER = b.Account_Number and
        a.reporting_date = b.reporting_date and
        a.reporting_date < b.RATE_EFFECTIVE_DATE;
        
quit;
PG

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!

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
  • 1 reply
  • 604 views
  • 0 likes
  • 2 in conversation