BookmarkSubscribeRSS Feed
Dhana18
Obsidian | Level 7

Good morning,

I have a data set like this.  I want to know mean number of visit per patient.  Same Incidentid and different visdate means same patient visiting clinic more than one time on different dates.   

 

How to code for the result i want?

IncidentID	VISDATE
1	7/3/2017
2	7/3/2017
3	7/5/2017
4	7/5/2017
5	7/5/2017
6	7/7/2017
6	7/5/2017
7	7/5/2017
8	7/5/2017
8	7/7/2017
9	7/5/2017
10	7/6/2017
11	7/6/2017
12	7/6/2017
12	7/17/2017
13	7/6/2017
14	7/7/2017
15	7/12/2017

 

1 REPLY 1
Jagadishkatam
Amethyst | Level 16

Hope this helps

 

data have;
input IncidentID VISDATE:mmddyy10.;
cards;
1  7/3/2017
2  7/3/2017
3  7/5/2017
4  7/5/2017
5  7/5/2017
6  7/7/2017
6  7/5/2017
7  7/5/2017
8  7/5/2017
8  7/7/2017
9  7/5/2017
10 7/6/2017
11 7/6/2017
12 7/6/2017
12 7/17/2017
13 7/6/2017
14 7/7/2017
15 7/12/2017
;

proc sort data=have nodupkey;
by IncidentID VISDATE;
run;

proc freq data=have;
table IncidentID/out=want;
run;

 

 

Thanks,
Jag

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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