<?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 tabulate percentage and &amp;quot;where&amp;quot; statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-percentage-and-quot-where-quot-statement/m-p/817222#M322571</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have some questions on proc tabulate.&lt;/P&gt;
&lt;P&gt;1. I want to get one decimal for percentages.&lt;/P&gt;
&lt;P&gt;2. I want to put % sign after percentages.&lt;/P&gt;
&lt;P&gt;3. EnglishLearnerEL variable is either Y or N. I want to display only when&amp;nbsp;EnglishLearnerEL is Y. When I use where=&amp;nbsp;EnglishLearnerEL="Y" it excludes&amp;nbsp;EnglishLearnerEL =N and display only "Y" results. However, I want to show only&amp;nbsp;EnglishLearnerEL =Y, not exclude them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is below.&lt;/P&gt;
&lt;P&gt;Thank you for your help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=inc_sdf_alg_1 out=inc_sdf_alg_1_gender;
class  gender EnglishLearnerEL ;
table (gender EnglishLearnerEL)*(N*format=comma16. colpctn*f=percentn7.2) (all= 'Total'* format=comma16.),
 (all= 'Total'*format=comma16.);
 where EnglishLearnerEL="Y" ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jun 2022 03:29:16 GMT</pubDate>
    <dc:creator>dustychair</dc:creator>
    <dc:date>2022-06-09T03:29:16Z</dc:date>
    <item>
      <title>proc tabulate percentage and "where" statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-percentage-and-quot-where-quot-statement/m-p/817222#M322571</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have some questions on proc tabulate.&lt;/P&gt;
&lt;P&gt;1. I want to get one decimal for percentages.&lt;/P&gt;
&lt;P&gt;2. I want to put % sign after percentages.&lt;/P&gt;
&lt;P&gt;3. EnglishLearnerEL variable is either Y or N. I want to display only when&amp;nbsp;EnglishLearnerEL is Y. When I use where=&amp;nbsp;EnglishLearnerEL="Y" it excludes&amp;nbsp;EnglishLearnerEL =N and display only "Y" results. However, I want to show only&amp;nbsp;EnglishLearnerEL =Y, not exclude them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is below.&lt;/P&gt;
&lt;P&gt;Thank you for your help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=inc_sdf_alg_1 out=inc_sdf_alg_1_gender;
class  gender EnglishLearnerEL ;
table (gender EnglishLearnerEL)*(N*format=comma16. colpctn*f=percentn7.2) (all= 'Total'* format=comma16.),
 (all= 'Total'*format=comma16.);
 where EnglishLearnerEL="Y" ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 03:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-percentage-and-quot-where-quot-statement/m-p/817222#M322571</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2022-06-09T03:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate percentage and "where" statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-percentage-and-quot-where-quot-statement/m-p/817241#M322577</link>
      <description>&lt;P&gt;The WHERE statement filters the input, so PROC TABULATE never "sees" anything but the "Y" values, which then constitute 100%.&lt;/P&gt;
&lt;P&gt;I suggest that you use PROC TABULATE with the OUT= option to create a dataset, and then print your report from that, filtering there without affecting the values.&lt;/P&gt;
&lt;P&gt;For code suggestions, supply example data in a working data step with datalines, and show the expected result from that.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 08:39:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-percentage-and-quot-where-quot-statement/m-p/817241#M322577</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-09T08:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate percentage and "where" statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-percentage-and-quot-where-quot-statement/m-p/817261#M322589</link>
      <description>&lt;P&gt;Here's an approach you can use for a Y/N variable when&amp;nbsp; you want to print the percentage of Y values but not the percentage of N values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a DATA step, create a new variable that is 1 when the Y/N variable is Y, and 0 when it is N.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In PROC TABULATE, use that new variable in a VAR statement.&amp;nbsp; Tell PROC TABULATE to compute the mean of that new variable, and print the mean in the percent8.1 format.&amp;nbsp; Note that the mean of a 0/1 variable is the percentage of 1's.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 10:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-percentage-and-quot-where-quot-statement/m-p/817261#M322589</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-06-09T10:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate percentage and "where" statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-percentage-and-quot-where-quot-statement/m-p/817564#M322709</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks for suggestions. The first two statements resolved my first and second questions. Even though I could not resolve it this link is for the question 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings13/134-2013.pdf" target="_blank"&gt;134-2013: Tips for Generating Percentages Using the SAS® TABULATE Procedure&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture pfmt (round) low-high='009.9%';&lt;BR /&gt;
proc tabulate data=sdf.inc_sdf_&amp;amp;d._&amp;amp;j.  out=inc_sdf_&amp;amp;j._&amp;amp;d._desc;
class  gender EnglishLearnerEL ;
table Egender EnglishLearnerEL, (N*format=comma16.) (colpctn*f=pfmt.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jun 2022 04:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-percentage-and-quot-where-quot-statement/m-p/817564#M322709</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2022-06-11T04:24:24Z</dc:date>
    </item>
  </channel>
</rss>

