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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 525 views
  • 1 like
  • 2 in conversation