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

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
  • 727 views
  • 1 like
  • 2 in conversation