<?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 how can i use where condition for each step using proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375266#M89934</link>
    <description>&lt;P&gt;I am counting number of subjects of screened and screen failure and need to condition them based on condition&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; create table scrnd&amp;nbsp;as&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;select count(SUBJID) as screened&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;where term="SCREENED" from subjd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; create table&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;scrfail as&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;select count(SUBJID) as scrnfail&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;where term="SCRNFAIL" from subjd;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any precise way to do only in one create statement to get rid of set later?&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jul 2017 11:23:59 GMT</pubDate>
    <dc:creator>vraj1</dc:creator>
    <dc:date>2017-07-12T11:23:59Z</dc:date>
    <item>
      <title>how can i use where condition for each step using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375266#M89934</link>
      <description>&lt;P&gt;I am counting number of subjects of screened and screen failure and need to condition them based on condition&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; create table scrnd&amp;nbsp;as&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;select count(SUBJID) as screened&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;where term="SCREENED" from subjd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; create table&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;scrfail as&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;select count(SUBJID) as scrnfail&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;where term="SCRNFAIL" from subjd;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any precise way to do only in one create statement to get rid of set later?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 11:23:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375266#M89934</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2017-07-12T11:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use where condition for each step using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375268#M89936</link>
      <description>&lt;P&gt;Since you get only 1-column,1-row datasets in each step, what are you planning to do with the contents of these datasets later?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 11:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375268#M89936</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-12T11:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use where condition for each step using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375269#M89937</link>
      <description>&lt;P&gt;I am making a table of various counts of patients and wondering if there is any smarter way in doing in single create statement&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 11:30:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375269#M89937</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2017-07-12T11:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use where condition for each step using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375271#M89939</link>
      <description>&lt;P&gt;Use proc freq for that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input subjid term $;
cards;
1 SCREENED
2 SCREENED
3 SCRNFAIL
4 SCREENED
5 SCRNFAIL
;
run;

proc freq data=have;
tables term / out=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jul 2017 11:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375271#M89939</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-12T11:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use where condition for each step using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375273#M89941</link>
      <description>&lt;P&gt;There are numerous options, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;proc freq is the simplest. &amp;nbsp;You could also use union:&lt;/P&gt;
&lt;PRE&gt;proc sql;
    create table scrnd as
    select count(SUBJID) as screened  
    from subjd
    where term="SCREENED"
    union all
    select count(SUBJID) as scrnfail
    from subjd
    where term="SCRNFAIL"; 
quit;&lt;/PRE&gt;
&lt;P&gt;Or use a datastep and retain counts. &amp;nbsp;To be honest your question is pretty vague.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 11:39:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-i-use-where-condition-for-each-step-using-proc-sql/m-p/375273#M89941</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-12T11:39:51Z</dc:date>
    </item>
  </channel>
</rss>

