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

Hi

I am still plugging away on the readmits program and I figured it out but I want to remove multiple readmits for the same patient's episode.  If I use the following code, it works but it removes all entries for a chart number when really I only want to remove when the same chartno with the same admit date is duplicated.  So if the same chart number had a different admit date I don't want it removed.

data single dup;

set temp;

by chartno;

if first.chartno and last.chartno then output single;

else output dup;

run;

So is it possible to do have a first observation with two fields like first.chartno admdate and last.chartno admdate?  Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16

I hope, this will help you

data single dup;

set temp;

by chartno admit_date;

if first.admit_date then output single;

else output dup;

run;

Thanks,

jagadish

Thanks,
Jag

View solution in original post

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

Please try

data single dup;

set temp;

by chartno admit_date;

if first.admit_date and last.admit_date then output single;

else output dup;

run;

Thanks,

Jagadish

Thanks,
Jag
shellp55
Quartz | Level 8

Thanks so much Jagadish but that didn't work.  I had a case with 3 readmits noted for one chart number, 2 were the same admit date and the third wasn't but the code wiped out all but one.

Any other suggestions?  Thanks so much.

Jagadishkatam
Amethyst | Level 16

I hope, this will help you

data single dup;

set temp;

by chartno admit_date;

if first.admit_date then output single;

else output dup;

run;

Thanks,

jagadish

Thanks,
Jag
shellp55
Quartz | Level 8

Hi

Thanks so much, that seems to have worked!

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