BookmarkSubscribeRSS Feed
Deepai
Calcite | Level 5

i have 400 clusters, each cluster has around 50 people. i want to get the proportion of diabetes people in each cluster and create new variable naming proportion of Diabetes in the same dataset can someone help me with this

4 REPLIES 4
ed_sas_member
Meteorite | Level 14

Hi @Deepai 

You can run a PROC FREQ to do this.

Assuming you have a dummy variable indicating the status of the patient regarding diabetes:

proc freq data=have noprint;
   tables flag * cluster_id / out=want;
run;
Deepai
Calcite | Level 5
Thank yiu
ed_sas_member
Meteorite | Level 14
Thank you @Deepai!
Could you please mark the topic as answered and close it? Thank you.
Deepai
Calcite | Level 5

thank you for the information, I got it but in a separate dataset

 

However i am trying to get the proportion of diabetes by clusters in the same dataset. 

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