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

I need some help to delete few rows from the below table based on some conditions.

 

For some IDs  for a Year the table has two entries one with value in the amt field and other is empty.

I have to delete the records of the IDs which has more than 1 entry for a year and the amt field is empty.

Please help.

 

IDYearAmt 
700000312009. 
700000312010. 
700000312011. Needs to Be Deleted
700000312011526.2906 
700000312012. 
700000312013200 
700000312014. 
700000312015. 
700000312016. Needs to Be Deleted
700000312016119 
700008952009. 
700008952010100 
700008952011. 
700008952012. Needs to Be Deleted
7000089520122186.864 
700008952013. 
700008952014. 
700008952015. Needs to Be Deleted
700008952015340.2716 
700008952016. 
7000089520176789 
1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

If you don't have multiple records for a given id and year that contain non-missing amounts, then the update statement would be your easiest solution. e.g.:

data want;
  update have (obs=0) have;
   by id year;
run;

Art, CEO, AnalystFinder.com

View solution in original post

1 REPLY 1
art297
Opal | Level 21

If you don't have multiple records for a given id and year that contain non-missing amounts, then the update statement would be your easiest solution. e.g.:

data want;
  update have (obs=0) have;
   by id year;
run;

Art, CEO, AnalystFinder.com

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 1034 views
  • 1 like
  • 2 in conversation