<?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: show row with missing data in a summary table in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104956#M29323</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ... yes, I suggested SUMMARY.&amp;nbsp; I don't think that the suggestion &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;where trtel=1 c&lt;SPAN style="font-size: 12.800000190734863px; background-color: #ffffff;"&gt;hanged to &lt;/SPAN&gt;where trtel=1 or leg_sort='placebo'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; select count(distinct subjid) as n, leg_sort, 'Subjects evaluable for AE' as text&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; from new&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; where trtrel eq 1 or leg_sort eq 'placebo'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; group by leg_sort;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;n&amp;nbsp; leg_sort&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;2&amp;nbsp; drug&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Subjects evaluable for AE&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;1&amp;nbsp; placebo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Subjects evaluable for AE&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;does what you want in that you get a count of 1&amp;nbsp; for placebo since rather than the 0 that you want.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Given my meager SQL knowledge, I cannot think of an easy SQL approach since you are asking PROC SQL to produce a count for something that is not in your data set.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;That is why I suggested SUMMARY so you could have a format &lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;rather than your data dictate the groups that appear in your table &lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;(including zero counts).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Aug 2012 15:04:55 GMT</pubDate>
    <dc:creator>MikeZdeb</dc:creator>
    <dc:date>2012-08-28T15:04:55Z</dc:date>
    <item>
      <title>show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104948#M29315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp; Hi everyone, I got the next code that generate adv1 (a summary table):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; data new;&lt;BR /&gt;&amp;nbsp; length subjid leg_sort aeterm $20. trtrel 8.;&lt;BR /&gt;&amp;nbsp; input subjid leg_sort aeterm trtrel;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;&amp;nbsp; 100 drug drymouth&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp; 101 drug drymouth&amp;nbsp; 1&lt;BR /&gt;&amp;nbsp; 102 placebo&amp;nbsp; drymount 0&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;&amp;nbsp; create table adv1 as&lt;BR /&gt;&amp;nbsp; select count(distinct subjid) as n, leg_sort, 'Subjects evaluable for AE' as text&lt;BR /&gt;&amp;nbsp; from new&lt;BR /&gt;&amp;nbsp; where trtrel=1&lt;BR /&gt;&amp;nbsp; group by leg_sort;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my problem is that I would like to include the row placebo&amp;nbsp; with N= .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e, I&amp;nbsp; want to generate a dataset including all the possible values of leg_sort considering the values with missing data (placebo in my example).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnaks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2012 12:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104948#M29315</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2012-08-27T12:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104949#M29316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Mitchka:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have not demonstrated a problem of dealing with missing data.&amp;nbsp; You've shown the effect of using "where trtel=1".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2012 13:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104949#M29316</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2012-08-27T13:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104950#M29317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The option where is neccessary, because i am interested in the records trtrel=1,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I know that&lt;/STRONG&gt; &lt;STRONG&gt;there is not record&lt;/STRONG&gt; of Placebo, but instead of not showing it, I am interested to consider &lt;STRONG&gt;not missing data (it is wrong, sorry, my mistake in the tittle),&lt;/STRONG&gt; I am interested to consider the placebo raw with 0 value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;leg_sort&amp;nbsp;&amp;nbsp;&amp;nbsp; N&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drug&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Placebo&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2012 14:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104950#M29317</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2012-08-27T14:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104951#M29318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are more combinations than shown in your desired output.&amp;nbsp; Will you get what you want by using proc freq?&amp;nbsp; e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data=new;&lt;/P&gt;&lt;P&gt;&amp;nbsp; tables trtrel*leg_sort*aeterm;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2012 15:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104951#M29318</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-27T15:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104952#M29319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... three PROCs support preloading a format ... MEANS (SUMMARY), TABULATE, REPORT ... that make groups in your output dependent on a format rather than on your data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so, you can use SUMMARY with one or more CLASS variables to make a data set of counts, for example ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;proc format;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;value $leg_sort 'drug' = 'drug' 'placebo' = 'placebo';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data new;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;input subjid (leg_sort aeterm) (:$20.) trtrel;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;100 drug drymouth&amp;nbsp; 1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;101 drug drymouth&amp;nbsp; 1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;102 placebo&amp;nbsp; drymount 0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;proc summary data=new nway completetypes;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;class leg_sort / preloadfmt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;output out=counts (drop=_type_ rename=(_freq_ = N));&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;where trtrel eq 1;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;format leg_sort $leg_sort.;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;data set COUNTS ...&lt;/SPAN&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; leg_sort&amp;nbsp;&amp;nbsp;&amp;nbsp; N&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; drug&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; placebo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2012 16:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104952#M29319</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-08-27T16:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104953#M29320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you not then just add "or leg_sort='placebo'" to your where clause?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where trtel=1 or leg_sort='placebo'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2012 20:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104953#M29320</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2012-08-27T20:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104954#M29321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thnak you mkeintz for making this dataset with proc summary,...but there one way to do the same using proc sql?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the reason I insisted with proc sql is because it is part of a macro, and the macro consider always 2 rows, this the reason i need to create that extra row of placebo with 0 values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnakls.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2012 13:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104954#M29321</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2012-08-28T13:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104955#M29322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did not demonstrate the proc summary - that was Mike Zdeb.&amp;nbsp; My suggestion was explicitly for your PROC SQL which currently has &lt;STRONG&gt;where trtel=1&lt;/STRONG&gt; and could easily be changed to &lt;STRONG&gt;where trtel=1 or leg_sort='placebo'&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2012 14:13:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104955#M29322</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2012-08-28T14:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104956#M29323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ... yes, I suggested SUMMARY.&amp;nbsp; I don't think that the suggestion &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;where trtel=1 c&lt;SPAN style="font-size: 12.800000190734863px; background-color: #ffffff;"&gt;hanged to &lt;/SPAN&gt;where trtel=1 or leg_sort='placebo'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; select count(distinct subjid) as n, leg_sort, 'Subjects evaluable for AE' as text&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; from new&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; where trtrel eq 1 or leg_sort eq 'placebo'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; group by leg_sort;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;n&amp;nbsp; leg_sort&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;2&amp;nbsp; drug&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Subjects evaluable for AE&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;1&amp;nbsp; placebo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Subjects evaluable for AE&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;does what you want in that you get a count of 1&amp;nbsp; for placebo since rather than the 0 that you want.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Given my meager SQL knowledge, I cannot think of an easy SQL approach since you are asking PROC SQL to produce a count for something that is not in your data set.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;That is why I suggested SUMMARY so you could have a format &lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;rather than your data dictate the groups that appear in your table &lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;(including zero counts).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2012 15:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104956#M29323</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-08-28T15:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104957#M29324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sorry for my confussion...but still not right...because&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abviously It generate a record with placebo n=1, and &lt;STRONG&gt;I am interesting in a dataset just as Mike Zdeb did (counts), but using proc sql. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;data set COUNTS ...&lt;/SPAN&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; leg_sort&amp;nbsp;&amp;nbsp;&amp;nbsp; N&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; drug&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; placebo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2012 15:09:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104957#M29324</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2012-08-28T15:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104958#M29325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yers, you right, this "or upcase(leg_sort)=PLACEBO" i am not interested in....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the way of proc sql you are right too, I was expected someone to help me with some condition to consider all&lt;/P&gt;&lt;P&gt;the possible values of leg_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont think there any option can cover it using proc sql....but i think we can create a final dataset considering this extra record placebo with 0 value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2012 15:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104958#M29325</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2012-08-28T15:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104959#M29326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming you change the WHERE clause to add "or upcase(leg_sort)='PLACEBO'" you have two ways to fix the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could always use a DATA step before printing to change N for Placebo to 0.&amp;nbsp; Alternatively, you could select a more complex statistic that doesn't require a subsequent DATA step.&amp;nbsp; You'll have to check the syntax on this because SQL is a secondary language for me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select min( count(distinct subjid), sum(trtrel) ) as N,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2012 15:45:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104959#M29326</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-08-28T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104960#M29327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, I understand now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then how about a union of the "where trtel"&amp;nbsp; where you count the subject id's with the "leg_sort eq 'placebo'" case with N specified as missing.&amp;nbsp; I only tested this SQL code with your 3 observations, but it worked in that case (I prefer proc summary).&amp;nbsp; I moved the respective WHERE clauses into data set name parameters so that I didn't have to figure out their influence as sql expressions.&amp;nbsp; SQL mavens might have a much more elegant way to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; select count(distinct subjid) as n, leg_sort, 'Subjects Available for AE' as text&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; from new (where=(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;trtrel eq 1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; union&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; select . as n, leg_sort, 'Subject Available for AE' as text&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; from new (where=(leg_sort eq 'placebo'))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; group by leg_sort;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2012 15:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104960#M29327</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2012-08-28T15:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: show row with missing data in a summary table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104961#M29328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks mkeintz, this exactly like I wanted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to add an if consition to your code, because not always n(placebo)=.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 08:51:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/show-row-with-missing-data-in-a-summary-table/m-p/104961#M29328</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2012-08-29T08:51:29Z</dc:date>
    </item>
  </channel>
</rss>

