BookmarkSubscribeRSS Feed
raveena
Obsidian | Level 7

Hi,

I have a dataset with columns clam,lineno and paiddate..Each clamno no has multiple lineno with paiddate.
For example if am processing for june month..

selection criteria:
1.Need to should skip the clam 1 bcoz the clamno is not within the processing month.
2.I can select the clam 2 bcoz the clamno is within the processing month.
3.Need to skip the clam 3 bcoz its ot within the processing month.

clam      lineno         paiddate
1          001         04/11/2011
           002         06/15/2011
           003         07/02/2011

2          001         04/11/2011
           004         06/15/2011
           005         06/28/2011

3          002         04/11/2011
           006         05/11/2011
           007         05/28/2011

and so on..........

So output should be ,

clam      lineno         paiddate

2          001         04/11/2011
           004         06/15/2011
           005         06/28/2011

Please let me know how to get this desired output.

Thanks

2 REPLIES 2
NN
Quartz | Level 8 NN
Quartz | Level 8

Hi..

A simple method would be to select * and max of paiddate

group the data by clam. and then filter out all records where month of the new column is june .

art297
Opal | Level 21

One way of doing it might be:

data need;

  set have;

  retain claim;

  if not missing(clam) then claim=clam;

run;

proc sql noprint;

  create table want (drop=claim) as

    select * from need

      group by claim

        having month(max(paiddate)) eq 6

          order by lineno

;

quit;

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
  • 2 replies
  • 553 views
  • 0 likes
  • 3 in conversation