<?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: using proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514370#M138713</link>
    <description>i have found out till this&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select count(distinct pt)&lt;BR /&gt;into :n1 from dispositon&lt;BR /&gt;where rand = 1;&lt;BR /&gt;select count(distinct pt)&lt;BR /&gt;into :n2&lt;BR /&gt;from dispositon&lt;BR /&gt;where complete = 0;&lt;BR /&gt;select count(distinct pt)&lt;BR /&gt;into :n3&lt;BR /&gt;from dispositon&lt;BR /&gt;where complete =1;&lt;BR /&gt;select count(distinct pt)&lt;BR /&gt;into :n4&lt;BR /&gt;from dispositon where safety = 1;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;i want the seperate count when trt is 2 and 1&lt;BR /&gt;like&lt;BR /&gt;trt 1 trt2&lt;BR /&gt;randomized 2 2&lt;BR /&gt;perprotocol 0 0&lt;BR /&gt;</description>
    <pubDate>Mon, 19 Nov 2018 08:32:56 GMT</pubDate>
    <dc:creator>Aayushi_17</dc:creator>
    <dc:date>2018-11-19T08:32:56Z</dc:date>
    <item>
      <title>using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514349#M138703</link>
      <description>&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;treat&lt;/TD&gt;&lt;TD&gt;COMPLETE&lt;/TD&gt;&lt;TD&gt;SAFETY&lt;/TD&gt;&lt;TD&gt;RAND&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/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&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Safety&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;xx (xx.x%)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;xx (xx.x%)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Per Protocol&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;xx (xx.x%)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;xx (xx.x%)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Completed&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;xx (xx.x%)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;xx (xx.x%)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Discontinued&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;xx (xx.x%)&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;xx (xx.x%)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 19 Nov 2018 06:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514349#M138703</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2018-11-19T06:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514350#M138704</link>
      <description>&lt;P&gt;I don't understand your question? And why is PP not a part of your data?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 06:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514350#M138704</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-11-19T06:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514352#M138705</link>
      <description>&lt;P&gt;yes PP is not part if my data and the output should be 0 for that&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 06:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514352#M138705</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2018-11-19T06:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514353#M138706</link>
      <description>And why proc SQL? Is this homework? If so, please post what you tried so far.</description>
      <pubDate>Mon, 19 Nov 2018 06:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514353#M138706</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2018-11-19T06:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514370#M138713</link>
      <description>i have found out till this&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select count(distinct pt)&lt;BR /&gt;into :n1 from dispositon&lt;BR /&gt;where rand = 1;&lt;BR /&gt;select count(distinct pt)&lt;BR /&gt;into :n2&lt;BR /&gt;from dispositon&lt;BR /&gt;where complete = 0;&lt;BR /&gt;select count(distinct pt)&lt;BR /&gt;into :n3&lt;BR /&gt;from dispositon&lt;BR /&gt;where complete =1;&lt;BR /&gt;select count(distinct pt)&lt;BR /&gt;into :n4&lt;BR /&gt;from dispositon where safety = 1;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;i want the seperate count when trt is 2 and 1&lt;BR /&gt;like&lt;BR /&gt;trt 1 trt2&lt;BR /&gt;randomized 2 2&lt;BR /&gt;perprotocol 0 0&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Nov 2018 08:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514370#M138713</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2018-11-19T08:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514375#M138716</link>
      <description>&lt;P&gt;What you have there is a clinical report.&amp;nbsp; Your company will have specific standards, macros etc. so you should really look into that with a colleague.&amp;nbsp; The code associated with created those types of outputs are proprietary so cannot be shared.&amp;nbsp; You can of course do something like:&lt;/P&gt;
&lt;PRE&gt;proc sql;&lt;BR /&gt;  /* Create empty table */
  create table want (co1l char(200),trt1 char(200),trt2 char(200));&lt;BR /&gt;  /* Get treatment populations */
  select count(distinct usubjid) into :t1 from have where treat=1;
  select count(distinct usubjid) into :t2 from have where treat=2;&lt;BR /&gt;  /* Insert counts */
  insert into want 
  set col1="Randomized",
      trt1=(select strip(put(count(distinct usubjid),best.))||" ("||put((count(distinct usubjid) / &amp;amp;t1.)*100,4.1) from have where rand=1 and treat=1),
      trt2=(select strip(put(count(distinct usubjid),best.))||" ("||put((count(distinct usubjid) / &amp;amp;t2.)*100,4.1) from have where rand=1 and treat=2)
  insert into want...
;
quit;
          &lt;/PRE&gt;
&lt;P&gt;So you can do that one table in one sql like that.&amp;nbsp; Mostly though that will be a long winded way of doing it.&amp;nbsp; You are better off learning the specific SAS functions like freq, means, summary, and using them to get counts.&amp;nbsp; Then process the output in a datastep.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 08:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-proc-sql/m-p/514375#M138716</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-11-19T08:40:30Z</dc:date>
    </item>
  </channel>
</rss>

