<?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 Re: Proc tabulate selecting one level of a variable to be printed in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608527#M76661</link>
    <description>Not easily. It’s easier to push the proc tabulate table to a dataset, filter it and then use proc report to display it.</description>
    <pubDate>Sun, 01 Dec 2019 01:56:24 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-12-01T01:56:24Z</dc:date>
    <item>
      <title>Proc tabulate selecting one level of a variable to be printed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608522#M76660</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm using proc tabulate to create a table and I'm wondering if there's a way to select one level of a categorical variable to be printed, but keeping the % considering all the levels.&lt;/P&gt;&lt;P&gt;See below the table that I have. I wanted the same table but to export in excel only the lines 'Yes' for the variable sick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Example Table 1.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34349iA2B1A7D8E03ACDD2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Example Table 1.png" alt="Example Table 1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;See the code I have right now. Any other ideas are welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="C:\ExampleTable1.xlsx" style=minimal;
proc tabulate data=ex;
class sick sex doctor location;
table (sex=' ')*(sick=' ' all), (location=' ' ALL)*(doctor=' ')*(n pctn&amp;lt;sick all&amp;gt;*f=10.1)/ nocellmerge printmiss misstext='0' box="Sick";
keylabel PctN="%" N="n" All="Total";
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Dec 2019 00:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608522#M76660</guid>
      <dc:creator>MilenaNF</dc:creator>
      <dc:date>2019-12-01T00:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate selecting one level of a variable to be printed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608527#M76661</link>
      <description>Not easily. It’s easier to push the proc tabulate table to a dataset, filter it and then use proc report to display it.</description>
      <pubDate>Sun, 01 Dec 2019 01:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608527#M76661</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-12-01T01:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate selecting one level of a variable to be printed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608608#M76662</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;thanks for your reply. I'm not very familiar with proc report, would you be able to show me an example on how to use proc report to output a table similar to the one I have now?&lt;/P&gt;</description>
      <pubDate>Sun, 01 Dec 2019 23:49:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608608#M76662</guid>
      <dc:creator>MilenaNF</dc:creator>
      <dc:date>2019-12-01T23:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate selecting one level of a variable to be printed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608610#M76663</link>
      <description>Sorry, I'm not as familiar with PROC REPORT either. &lt;BR /&gt;&lt;BR /&gt;I would expect that you would use an ACROSS to specify the doctors/location and then the Gender/Sick Variable as grouping variables. &lt;BR /&gt;You can use COMPUTE if want to custom format your data. &lt;BR /&gt;&lt;BR /&gt;Note that you I strongly suspect you'll still need to use PROC TABULATE to get the percentages or PROC FREQ. &lt;BR /&gt;&lt;BR /&gt;You could also just use PROC FREQ + TRANSPOSE + PROC PRINT to display it if you're not familiar with PROC REPORT.&lt;BR /&gt;&lt;BR /&gt;PROC TABULATE has an OUT= option on the statement that will push your data to an output data set. &lt;BR /&gt;&lt;BR /&gt;Proc Report examples - there's a few that are relevant to you or you can find many many examples on Lexjansen.com. I'd probably find the one that was closest to what I wanted and start from there. &lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=n1pl56sdqo09cyn1fifuhcz8dl2f.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=n1pl56sdqo09cyn1fifuhcz8dl2f.htm&amp;amp;locale=en&lt;/A&gt;</description>
      <pubDate>Mon, 02 Dec 2019 00:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608610#M76663</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-12-02T00:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate selecting one level of a variable to be printed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608761#M76664</link>
      <description>&lt;P&gt;For Yes/No True/False type variables I generally find that a numeric value coded 1/0 works best for what you describe as a want. The SUM of a 1/0 coded variable is the count of "Yes" or "True" and the mean is the percentage of Yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So perhaps:&lt;/P&gt;
&lt;PRE&gt;data want;
   set ex;
   sicknum= (Sick='Yes');
run;

proc tabulate data=want;
   class  sex doctor location;
   var Sicknum ;
   table (sex=' ')*(sicknum=' ' , 
         (location=' ' ALL)*(doctor=' ')*(sum='n'*f=best5. mean='%'*f=percent8.1))/ nocellmerge printmiss misstext='0' box="Sick";
   ;
run;
  
&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Dec 2019 16:29:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608761#M76664</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-02T16:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate selecting one level of a variable to be printed</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608822#M76669</link>
      <description>&lt;P&gt;Hi, it worked, thank you so much!!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 19:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-selecting-one-level-of-a-variable-to-be-printed/m-p/608822#M76669</guid>
      <dc:creator>MilenaNF</dc:creator>
      <dc:date>2019-12-02T19:21:33Z</dc:date>
    </item>
  </channel>
</rss>

