BookmarkSubscribeRSS Feed
CharlesR
Calcite | Level 5
Hi,
This should be crazy easy, buti just can't get the right combo of variables in the by and tables portion to give me the percentages i want.

i'm running proc freq like this:
[pre]
proc freq data = Def_Hits noprint;
by zone BallInPlayType BattedBallVelocity DblPlayPosn BatSide PlayRes_forPerc;
tables Respfielder/ out = UZR;
run;
[/pre]

and it's outputting this:
[pre]
zone BPT BBV DP BSi PR Rf COUNT PERCENT
78D 1 2 Y L Out 1 2 0.913242009
78D 1 2 Y R Out 1 1 0.510204082
78D 1 3 N R Hit 1 3 0.563909774
78D 1 3 N R Out 1 1 0.178571429
[/pre]

What i want is for it to look like this:
[pre]
zone BPT BBV DP BSi PR Rf COUNT PERCENT
78D 1 2 Y L Out 1 2 100
78D 1 2 Y R Out 1 1 100
78D 1 3 N R Hit 1 3 75
78D 1 3 N R Out 1 1 25
[/pre]
in other words, for each combination of variables around the PR variable (Out/Hit), I want the percentage to calculate based on the count.

I'm just brain dead at this point and have tried several different permutations of by/tables and just can't get what i need. Anyone out there able to help this brain dead fellow out?

Thanks! Message was edited by: CharlesR
1 REPLY 1
CharlesR
Calcite | Level 5
Never mind, it's by PlayRes_forPerc (PR). sheesh. Been working too many late nights.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1667 views
  • 0 likes
  • 1 in conversation