BookmarkSubscribeRSS Feed
tony_miami
Calcite | Level 5
I'm pretty new to SAS coding and I'm a bit lost right now. How would you perform calculations with counts. For example, I want to get the rate of falls by type (same level falls, different level falls, etc... I created a variable to differentiate for each type of fall (same_fall, diff_fall).

How would I add up the type of falls and then divide it by the population?

Thanks,
1 REPLY 1
deleted_user
Not applicable
If you'd raised this in the Enterprise Guide forum my answer would have been slightly different, although the result would be the same.

It seems you want to perform a frequency analysis, you want a percentage for the frequency as a proportion of the population, and you want to perform it separately for each level of a variable that classifies a group to observe.

In Enterprise Guide there is a standard analysis task that will do everything for you. In Foundation SAS, your can simply run code similar to the following:

Proc Freq Data = MYLIB.MYDATA Missing;
Tables CLASSVAR;
Run;

This will produce frequencies for each level of classvar, and percentages for each class as well as the whole population.

Kind regards

David

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!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

Discussion stats
  • 1 reply
  • 736 views
  • 0 likes
  • 2 in conversation