<?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: Adding conditions within proc tabulate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-conditions-within-proc-tabulate/m-p/139196#M261409</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perfect! Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Oct 2014 08:03:40 GMT</pubDate>
    <dc:creator>peter_sjogarde</dc:creator>
    <dc:date>2014-10-24T08:03:40Z</dc:date>
    <item>
      <title>Adding conditions within proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-conditions-within-proc-tabulate/m-p/139194#M261407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Hi, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;I am wondering if it is possible to add conditions within proc tabulate. I would like to be able to set a variable in the beginning of the script that includes or excludes a variable from proc tabulate. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;E.g. Is it be possible to set a condition for the calculation of test2 below. If a variable is set to ‘yes’ it will be calculated but it is set to ‘no’ it will not. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Any help would be appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;/Peter&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TITLE1 "Test";&lt;/P&gt;&lt;P&gt;PROC TABULATE&lt;/P&gt;&lt;P&gt;DATA=WORK.T_PUBL_CIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp; WHERE( unit = "&amp;amp;Unit");&lt;/P&gt;&lt;P&gt;&amp;nbsp; VAR test1 test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLASS type/ ORDER=UNFORMATTED MISSING;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TABLE /* Row Dimension */&lt;/P&gt;&lt;P&gt;type&lt;/P&gt;&lt;P&gt;ALL={LABEL="Total"},&lt;/P&gt;&lt;P&gt;/* Column Dimension */&lt;/P&gt;&lt;P&gt;test1={LABEL="test1"}*&lt;/P&gt;&lt;P&gt;&amp;nbsp; Mean={LABEL="" STYLE={JUST=RIGHT VJUST=BOTTOM NOBREAKSPACE=ON}}*F=PERCENTN6.&lt;/P&gt;&lt;P&gt;test2={LABEL="test2" STYLE={JUST=RIGHT VJUST=BOTTOM}}*&lt;/P&gt;&lt;P&gt;&amp;nbsp; Mean={LABEL="" STYLE={JUST=RIGHT VJUST=BOTTOM NOBREAKSPACE=ON}}*F=6.1&lt;/P&gt;&lt;P&gt;;;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 15:42:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-conditions-within-proc-tabulate/m-p/139194#M261407</guid>
      <dc:creator>peter_sjogarde</dc:creator>
      <dc:date>2014-10-23T15:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Adding conditions within proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-conditions-within-proc-tabulate/m-p/139195#M261408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basic approach would be macro code. I&lt;/P&gt;&lt;P&gt;%macro includeflag (flag = YES); /* this defaults to including the variable*/&lt;/P&gt;&lt;P&gt;"Test";&lt;/P&gt;&lt;P&gt;PROC TABULATE&lt;/P&gt;&lt;P&gt;DATA=WORK.T_PUBL_CIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp; WHERE( unit = "&amp;amp;Unit");&lt;/P&gt;&lt;P&gt;&amp;nbsp; VAR test1 test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLASS type/ ORDER=UNFORMATTED MISSING;&lt;/P&gt;&lt;P&gt;&amp;nbsp; TABLE /* Row Dimension */&lt;/P&gt;&lt;P&gt;type&lt;/P&gt;&lt;P&gt;ALL={LABEL="Total"},&lt;/P&gt;&lt;P&gt;/* Column Dimension */&lt;/P&gt;&lt;P&gt;test1={LABEL="test1"}*&lt;/P&gt;&lt;P&gt;&amp;nbsp; Mean={LABEL="" STYLE={JUST=RIGHT VJUST=BOTTOM NOBREAKSPACE=ON}}*F=PERCENTN6.&lt;/P&gt;&lt;P&gt;%if &amp;amp;flag = YES %then %do;&lt;/P&gt;&lt;P&gt;test2={LABEL="test2" STYLE={JUST=RIGHT VJUST=BOTTOM}}*&lt;/P&gt;&lt;P&gt;&amp;nbsp; Mean={LABEL="" STYLE={JUST=RIGHT VJUST=BOTTOM NOBREAKSPACE=ON}}*F=6.1&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;;;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%includeflag(Flag=NO); /* actually any value other than YES will skip test2*/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 16:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-conditions-within-proc-tabulate/m-p/139195#M261408</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-23T16:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding conditions within proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-conditions-within-proc-tabulate/m-p/139196#M261409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perfect! Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Oct 2014 08:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-conditions-within-proc-tabulate/m-p/139196#M261409</guid>
      <dc:creator>peter_sjogarde</dc:creator>
      <dc:date>2014-10-24T08:03:40Z</dc:date>
    </item>
  </channel>
</rss>

