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

how would i count distinct ID that are that have appointments after the next  28 days from today

 

ID         appt_date

1             6/30/2018

1             7/7/2018

1             7/18/2018

1             7/28/2018

1              8/6/2018

1              9/20/2017

2             6/17/2018

2             6/28/2018

2             7/5/2018

2             7/6/2018

 

want 

 

ID 1 has 4 appt after 28 days 

ID 2 has 0 appt after 28 days 

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

I think there are only 3 for ID1, are you sure it;s 4?

 

data have;
input ID         appt_date :mmddyy10.;
format appt_date mmddyy10.;
cards;
1             6/30/2018
1             7/7/2018
1             7/18/2018
1             7/28/2018
1              8/6/2018
1              9/20/2017
2             6/17/2018
2             6/28/2018
2             7/5/2018
2             7/6/2018
;
proc sql;
create table want as
select id, sum( appt_date>=intnx('days',today(),28)) as count_of_appoints
from have
group by id;
quit;

View solution in original post

1 REPLY 1
novinosrin
Tourmaline | Level 20

I think there are only 3 for ID1, are you sure it;s 4?

 

data have;
input ID         appt_date :mmddyy10.;
format appt_date mmddyy10.;
cards;
1             6/30/2018
1             7/7/2018
1             7/18/2018
1             7/28/2018
1              8/6/2018
1              9/20/2017
2             6/17/2018
2             6/28/2018
2             7/5/2018
2             7/6/2018
;
proc sql;
create table want as
select id, sum( appt_date>=intnx('days',today(),28)) as count_of_appoints
from have
group by id;
quit;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 587 views
  • 0 likes
  • 2 in conversation