BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MagD
Quartz | Level 8

 I need help in deleting a row, please. The output of the code is producing 2 lines. All the other variables are the same. How can I delete the column with the blank:

 

MagD_0-1622733784946.png

The output I want is:

MagD_1-1622733985375.png

I am using the following code:

proc sql;
create table Month
as select a.*,
b.finmonth,
case when a.goodcnt+a.badcnt = 0 and b.finmonth = 202103 then '0'
when a.goodcnt+a.badcnt = 1 and b.finmonth = 202103 then '1'
when a.goodcnt+a.badcnt = 2 and b.finmonth = 202103 then '2'
when a.goodcnt+a.badcnt = 3 and b.finmonth = 202103 then '3'
when a.goodcnt+a.badcnt = 4 and b.finmonth = 202103 then '4'
when a.goodcnt+a.badcnt = 5 and b.finmonth = 202103 then '5'
when a.goodcnt+a.badcnt = 6 and b.finmonth = 202103 then '6'
when a.goodcnt+a.badcnt = 7 and b.finmonth = 202103 then '7'
when a.goodcnt+a.badcnt = 8 and b.finmonth = 202103 then '8'
when a.goodcnt+a.badcnt = 9 and b.finmonth = 202103 then '9'
when a.goodcnt+a.badcnt = 10 and b.finmonth = 202103 then '10'
when a.goodcnt+a.badcnt > 10 and b.finmonth = 202103 then '>10'
end as 'No of Bureau Accounts'n

from Current_Month as a left join totaldata8 as b
on a.accountnumber =b.accountnumber
and a.branchcode =b.branchcode
and a.subaccountnumber=b.subaccountnumber;
quit;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Do you want to delete that column or that row?
You get multiple records because one of your data sets has multiple records for that observation based on the accountnumber, branchcode and subaccount number. So if you shouldn't have duplicates you may want to verify your input data set or you may need to update your join condition to account for something else. It's usually the latter in my experience.

View solution in original post

2 REPLIES 2
Reeza
Super User
Do you want to delete that column or that row?
You get multiple records because one of your data sets has multiple records for that observation based on the accountnumber, branchcode and subaccount number. So if you shouldn't have duplicates you may want to verify your input data set or you may need to update your join condition to account for something else. It's usually the latter in my experience.
MagD
Quartz | Level 8
Hey Reeza,

I used your suggestion of updating my join condition. It worked!
Thank you for your input. I appreciate it.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 908 views
  • 2 likes
  • 2 in conversation