<?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 Proc report group variables in same column in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-group-variables-in-same-column/m-p/678878#M24368</link>
    <description>&lt;P&gt;I would like to create a table like this, where the sex variable is under the name variable, and the sex variable does not have a column to itself. I do not want to create separate tables or have any blank rows. The code below, using 'noprint' and adding the 'F' in column definition and 'M' in a line in 'compute' is going the right direction, but currently gives me an 'M' before the males and at the end of the report. I do not want the 'M' at the end of the report.&lt;/P&gt;&lt;P&gt;I'm using SAS EG 7.4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I want this (I've added the ... to make this post shorter):&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Age&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alice&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Barbara&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;…&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alfred&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Henry&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Code so far:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=edu;
by sex name;
run;

proc report data=edu;
columns ('F' Sex Name ) Age;
define sex/group '' noprint;
define name/group;
define age/analysis;
compute after sex ;
   line 'M' @1 ;
   endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output from code above (with ... added):&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Age&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alice&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Barbara&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;…&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alfred&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Henry&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;…&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;William&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I'm using ODS excel then to output to an Excel file that I don't want to edit again.&lt;/P&gt;&lt;P&gt;Many thanks, and apologies if this has been asked before or I've left out essential details.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Aug 2020 13:58:35 GMT</pubDate>
    <dc:creator>PeterCulhane</dc:creator>
    <dc:date>2020-08-24T13:58:35Z</dc:date>
    <item>
      <title>Proc report group variables in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-group-variables-in-same-column/m-p/678878#M24368</link>
      <description>&lt;P&gt;I would like to create a table like this, where the sex variable is under the name variable, and the sex variable does not have a column to itself. I do not want to create separate tables or have any blank rows. The code below, using 'noprint' and adding the 'F' in column definition and 'M' in a line in 'compute' is going the right direction, but currently gives me an 'M' before the males and at the end of the report. I do not want the 'M' at the end of the report.&lt;/P&gt;&lt;P&gt;I'm using SAS EG 7.4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I want this (I've added the ... to make this post shorter):&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Age&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alice&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Barbara&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;…&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alfred&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Henry&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Code so far:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=edu;
by sex name;
run;

proc report data=edu;
columns ('F' Sex Name ) Age;
define sex/group '' noprint;
define name/group;
define age/analysis;
compute after sex ;
   line 'M' @1 ;
   endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output from code above (with ... added):&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Age&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alice&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Barbara&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;…&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alfred&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Henry&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;…&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;William&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;M&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I'm using ODS excel then to output to an Excel file that I don't want to edit again.&lt;/P&gt;&lt;P&gt;Many thanks, and apologies if this has been asked before or I've left out essential details.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 13:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-group-variables-in-same-column/m-p/678878#M24368</guid>
      <dc:creator>PeterCulhane</dc:creator>
      <dc:date>2020-08-24T13:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report group variables in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-group-variables-in-same-column/m-p/679021#M24370</link>
      <description>Hi:&lt;BR /&gt;  You need to use a COMPUTE block. See this paper: &lt;A href="https://support.sas.com/resources/papers/proceedings17/SAS0431-2017.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings17/SAS0431-2017.pdf&lt;/A&gt; particularly page 9, so you can see all the places you can write an extra line of text or line with a variable value using PROC REPORT.&lt;BR /&gt;  Then the examples on pages 18-20 approx show the use of COMPUTE BEFORE to do what you want to do, I think. &lt;BR /&gt;Hope this helps,&lt;BR /&gt;Cynthia</description>
      <pubDate>Tue, 25 Aug 2020 00:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-group-variables-in-same-column/m-p/679021#M24370</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-08-25T00:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report group variables in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-group-variables-in-same-column/m-p/679129#M24372</link>
      <description>&lt;P&gt;Very many thanks Cynthia, that worked.&lt;/P&gt;&lt;P&gt;I used this code from your paper successfully to suppress one value of a variable, but I don't understand how it worked.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;...
if region = 'Canada' then reglg = 0;
 else reglg = 1;
 endcomp;
 compute after region/ style=Header;
 line brktxt $varying. reglg;
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I understand setting the length to 0 will stop SAS from printing a blank line&lt;/P&gt;&lt;P&gt;But I don't understand how SAS knows to take the value of reglg as the length.&lt;/P&gt;&lt;P&gt;Many thanks again for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 12:08:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-group-variables-in-same-column/m-p/679129#M24372</guid>
      <dc:creator>PeterCulhane</dc:creator>
      <dc:date>2020-08-25T12:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report group variables in same column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-group-variables-in-same-column/m-p/679142#M24373</link>
      <description>Hi:&lt;BR /&gt;  Setting the value to 0 in the REGLG variable doesn't do anything by itself until I use the REGLG variable with the $VARYING format for writing variable length text. I can specify $VARYING's length as $VARYING100. (which means that the line could be anywhere in length from 1-100, but not greater than 100. Or I can specify $VARYING length-variable -- as I do in the case of the LINE statement in that example. $VARYING is very cool with PROC REPORT  because setting a LENGTH of 0 for the length variable will cause REPORT to suppress the LINE text.&lt;BR /&gt;Cynthia</description>
      <pubDate>Tue, 25 Aug 2020 12:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-group-variables-in-same-column/m-p/679142#M24373</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-08-25T12:51:33Z</dc:date>
    </item>
  </channel>
</rss>

