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.

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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 644 views
  • 0 likes
  • 1 in conversation