Help using Base SAS procedures

Proc Freq - can't get the right by/tables variables to get the % i want

Reply
Contributor
Posts: 58

Proc Freq - can't get the right by/tables variables to get the % i want

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
Contributor
Posts: 58

Re: Proc Freq - can't get the right by/tables variables to get the % i want

Never mind, it's by PlayRes_forPerc (PR). sheesh. Been working too many late nights.
Ask a Question
Discussion stats
  • 1 reply
  • 108 views
  • 0 likes
  • 1 in conversation