<?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 - Display Mean an Count in same column in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/285933#M16413</link>
    <description>&lt;P&gt;Yes, it depends on where you put the n/mean calc. Move them to after comma?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;post your current code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2016 18:46:23 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-07-20T18:46:23Z</dc:date>
    <item>
      <title>PROC TABULATE - Display Mean an Count in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/285931#M16412</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that looks almost like the one below:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4143iD2B6B08E2DD290D2/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="proc_tab1.PNG" title="proc_tab1.PNG" /&gt;&lt;/P&gt;&lt;P&gt;However, client&amp;nbsp;wants the N and Mean to be in the same column, and have Mean displayed below N. &amp;nbsp;I'm scratching my head. Is there any way that SAS could accomplish this?&amp;nbsp;i.e.,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Female &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|| &amp;nbsp;Male&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;======================&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|| &amp;nbsp;3&lt;/P&gt;&lt;P&gt;$44,789 &amp;nbsp; &amp;nbsp; &amp;nbsp; || $52,507&lt;/P&gt;&lt;P&gt;======================&lt;/P&gt;&lt;P&gt;etc.etc...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 18:41:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/285931#M16412</guid>
      <dc:creator>lin39</dc:creator>
      <dc:date>2016-07-20T18:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TABULATE - Display Mean an Count in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/285933#M16413</link>
      <description>&lt;P&gt;Yes, it depends on where you put the n/mean calc. Move them to after comma?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;post your current code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 18:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/285933#M16413</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-20T18:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TABULATE - Display Mean an Count in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/285948#M16414</link>
      <description>&lt;P&gt;Show your code so we could use the same the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The difference would be (guessing your current table statement)&lt;/P&gt;
&lt;P&gt;table education*(enrollment all='All'), sex*(n mean);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;change to&lt;/P&gt;
&lt;P&gt;table education*(enrollment all='All')*(n mean), sex;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 19:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/285948#M16414</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-20T19:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TABULATE - Display Mean an Count in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/285986#M16415</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Frequently, my students ask for this to produce standard "demographic" tables where they want to see something like this:&lt;/P&gt;
&lt;P&gt;N (Mean) or N (Min - Max) or N (PctN%)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where separate statistics are formatted and presented in one cell, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4147i44A78BB3A3CFEDB1/image-size/original?v=v2&amp;amp;px=-1" alt="make_combined_cell.png" title="make_combined_cell.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Compare the way the TABULATE (#1) output looks with the "combined" cell in the PROC REPORT (#2) output. This was done by making a character variable in PROC REPORT as a COMPUTED item and then formatting the N and the Mean and concatenating them with punctuation. Code is below -- if this is what you mean. If this is not what you mean, then post your TABULATE data and your code and provide more information about your desired result format (listing, HTML, RTF, PDF, Excel, etc). My output in the screen shot is the default HTML output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title;
proc tabulate data=sashelp.shoes;
  title '1) With PROC TABULATE -- combined cell is not possible';
  where region in ('Asia', 'Canada','Pacific') and
        product in ('Boot', 'Slipper' );
  class product region;
  var sales;
  table region * (product all),
        sales*(n mean);
run;

proc report data=sashelp.shoes;
  title '2) With PROC REPORT make combined cell';
  where region in ('Asia', 'Canada','Pacific') and
        product in ('Boot', 'Slipper' );
  column region product  sales sales=slmean combined;
  define region / group style(column) = Header;
  define product /group style(column)=Header;
  define sales / n f=4.0 noprint;
  define slmean / mean noprint;
  define combined / computed f=$50. 
         style(column)={just=r};
  compute combined / character length=50;
    combined = put(sales.n,4.0)||'  ('||put(slmean,dollar14.)||')';
  endcomp;
  break after region / summarize style=Header;
  compute after region;
    region = ' ';
    product = 'All';
  endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 22:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/285986#M16415</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-20T22:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TABULATE - Display Mean an Count in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/286015#M16418</link>
      <description>&lt;P&gt;Modify Cynthia's code a little bit .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title;
proc tabulate data=sashelp.shoes;
  title '1) With PROC TABULATE -- combined cell is not possible';
  where region in ('Asia', 'Canada','Pacific') and
        product in ('Boot', 'Slipper' );
  class product region;
  var sales;
  table region * (product all),
        sales*(n mean);
run;
ods escapechar='~';
proc report data=sashelp.shoes;
  title '2) With PROC REPORT make combined cell';
  where region in ('Asia', 'Canada','Pacific') and
        product in ('Boot', 'Slipper' );
  column region product  sales sales=slmean combined;
  define region / group style(column) = Header;
  define product /group style(column)=Header;
  define sales / n f=4.0 noprint;
  define slmean / mean noprint;
  define combined / computed f=$50. 
         style(column)={just=r};
  compute combined / character length=50;
    combined = put(sales.n,4.0)||' ~n ('||put(slmean,dollar14.)||')';
  endcomp;
  break after region / summarize style=Header;
  compute after region;
    region = ' ';
    product = 'All';
  endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4150iAF22D11A9A08F55B/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="x.png" title="x.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 01:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/286015#M16418</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-21T01:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TABULATE - Display Mean an Count in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/305800#M17184</link>
      <description>&lt;P&gt;Hi KSharp, &amp;nbsp;thank you so much. &amp;nbsp;I appreciate yours and Cynthia's code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is, I need to display N and mean of not only one var (i.e., Sales), but also 10 other variables like income, GPA, SAT. &amp;nbsp;If I use the method suggested, I need to define the N for each variable, then Mean, then define a combined field and a computing logic for the combined field for every var. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i.e.,&lt;/P&gt;&lt;P&gt;define MONEY / n f=4.0 noprint;&lt;BR /&gt;define SAT&amp;nbsp;/ n f=4.0 noprint;&lt;/P&gt;&lt;P&gt;define &lt;SPAN&gt;MONEY&lt;/SPAN&gt;mean / mean noprint;&lt;BR /&gt;define &lt;SPAN&gt;SAT&lt;/SPAN&gt;mean / mean noprint;&lt;/P&gt;&lt;P&gt;define &lt;SPAN&gt;MONEY&lt;/SPAN&gt;c / computed f=$50. style(column)={just=c};&lt;BR /&gt;define &lt;SPAN&gt;SAT&lt;/SPAN&gt;c / computed f=$50. style(column)={just=c};&lt;/P&gt;&lt;P&gt;compute &lt;SPAN&gt;MONEY&lt;/SPAN&gt;c / character length=50; &lt;SPAN&gt;MONEY&lt;/SPAN&gt;c = put(&lt;SPAN&gt;MONEY&lt;/SPAN&gt;.n,4.0)||' ~n ('||put(&lt;SPAN&gt;MONEY&lt;/SPAN&gt;mean, PERCENT9.1)||')'; endcomp;&lt;/P&gt;&lt;P&gt;etc etc for 10 vars.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is a lot of code and dfficult to manage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's your suggestion????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 21:19:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/305800#M17184</guid>
      <dc:creator>lin39</dc:creator>
      <dc:date>2016-10-19T21:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TABULATE - Display Mean an Count in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/305856#M17185</link>
      <description>My suggestion is to use a DATA step program and possibly a SAS macro definition to create the concatenated character variable with the N and the Mean in the DATA step so you can simplify the logic in the PROC REPORT. Look at Example 1 in this paper: &lt;A href="http://www2.sas.com/proceedings/forum2008/173-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/173-2008.pdf&lt;/A&gt; on page 9.&lt;BR /&gt;&lt;BR /&gt;  You will find the programs for the original paper here: &lt;A href="http://support.sas.com/rnd/papers/#SGF2008" target="_blank"&gt;http://support.sas.com/rnd/papers/#SGF2008&lt;/A&gt;  just scroll to the 2008 section and look for the paper title to find the zip file.&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Thu, 20 Oct 2016 03:58:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/305856#M17185</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-10-20T03:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TABULATE - Display Mean an Count in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/306447#M17213</link>
      <description>&lt;P&gt;Thanks so much, Cynthia. I will give it a try.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 20:47:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-TABULATE-Display-Mean-an-Count-in-same-column/m-p/306447#M17213</guid>
      <dc:creator>lin39</dc:creator>
      <dc:date>2016-10-21T20:47:29Z</dc:date>
    </item>
  </channel>
</rss>

