<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Proc Freq - can't get the right by/tables variables to get the % i want in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Freq-can-t-get-the-right-by-tables-variables-to-get-the-i/m-p/58847#M16538</link>
    <description>Hi,&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
i'm running proc freq like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc freq data = Def_Hits noprint;&lt;BR /&gt;
  by zone BallInPlayType BattedBallVelocity DblPlayPosn BatSide PlayRes_forPerc; &lt;BR /&gt;
  tables Respfielder/ out = UZR;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
and it's outputting this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
zone	BPT	BBV	DP	BSi	PR	Rf	COUNT	PERCENT&lt;BR /&gt;
78D	1	2	Y	L	Out	1	2	0.913242009&lt;BR /&gt;
78D	1	2	Y	R	Out	1	1	0.510204082&lt;BR /&gt;
78D	1	3	N	R	Hit	1	3	0.563909774&lt;BR /&gt;
78D	1	3	N	R	Out	1	1	0.178571429&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
What i want is for it to look like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
zone	BPT	BBV	DP	BSi	PR	Rf	COUNT	PERCENT&lt;BR /&gt;
78D	1	2	Y	L	Out	1	2	100&lt;BR /&gt;
78D	1	2	Y	R	Out	1	1	100&lt;BR /&gt;
78D	1	3	N	R	Hit	1	3	75&lt;BR /&gt;
78D	1	3	N	R	Out	1	1	25&lt;BR /&gt;
[/pre]&lt;BR /&gt;
in other words, for each combination of variables around the PR variable (Out/Hit), I want the percentage to calculate based on the count.&lt;BR /&gt;
&lt;BR /&gt;
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?&lt;BR /&gt;
&lt;BR /&gt;
Thanks!

Message was edited by: CharlesR</description>
    <pubDate>Thu, 28 Apr 2011 03:46:17 GMT</pubDate>
    <dc:creator>CharlesR</dc:creator>
    <dc:date>2011-04-28T03:46:17Z</dc:date>
    <item>
      <title>Proc Freq - can't get the right by/tables variables to get the % i want</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Freq-can-t-get-the-right-by-tables-variables-to-get-the-i/m-p/58847#M16538</link>
      <description>Hi,&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
i'm running proc freq like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc freq data = Def_Hits noprint;&lt;BR /&gt;
  by zone BallInPlayType BattedBallVelocity DblPlayPosn BatSide PlayRes_forPerc; &lt;BR /&gt;
  tables Respfielder/ out = UZR;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
and it's outputting this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
zone	BPT	BBV	DP	BSi	PR	Rf	COUNT	PERCENT&lt;BR /&gt;
78D	1	2	Y	L	Out	1	2	0.913242009&lt;BR /&gt;
78D	1	2	Y	R	Out	1	1	0.510204082&lt;BR /&gt;
78D	1	3	N	R	Hit	1	3	0.563909774&lt;BR /&gt;
78D	1	3	N	R	Out	1	1	0.178571429&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
What i want is for it to look like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
zone	BPT	BBV	DP	BSi	PR	Rf	COUNT	PERCENT&lt;BR /&gt;
78D	1	2	Y	L	Out	1	2	100&lt;BR /&gt;
78D	1	2	Y	R	Out	1	1	100&lt;BR /&gt;
78D	1	3	N	R	Hit	1	3	75&lt;BR /&gt;
78D	1	3	N	R	Out	1	1	25&lt;BR /&gt;
[/pre]&lt;BR /&gt;
in other words, for each combination of variables around the PR variable (Out/Hit), I want the percentage to calculate based on the count.&lt;BR /&gt;
&lt;BR /&gt;
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?&lt;BR /&gt;
&lt;BR /&gt;
Thanks!

Message was edited by: CharlesR</description>
      <pubDate>Thu, 28 Apr 2011 03:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Freq-can-t-get-the-right-by-tables-variables-to-get-the-i/m-p/58847#M16538</guid>
      <dc:creator>CharlesR</dc:creator>
      <dc:date>2011-04-28T03:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq - can't get the right by/tables variables to get the % i want</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Freq-can-t-get-the-right-by-tables-variables-to-get-the-i/m-p/58848#M16539</link>
      <description>Never mind, it's by PlayRes_forPerc (PR).  sheesh.  Been working too many late nights.</description>
      <pubDate>Thu, 28 Apr 2011 04:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Freq-can-t-get-the-right-by-tables-variables-to-get-the-i/m-p/58848#M16539</guid>
      <dc:creator>CharlesR</dc:creator>
      <dc:date>2011-04-28T04:08:03Z</dc:date>
    </item>
  </channel>
</rss>

