<?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: Merging Cells Vertically in PROC REPORT RTF in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265364#M15676</link>
    <description>&lt;P&gt;Ah.Here is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile='/folders/myfolders/test.xlsx' dbms=xlsx out=have replace;
run;
data all;
 set have;
 if not missing(test) then _test=test;
  else test=_test;
 if not missing(variable) then _variable=variable;
  else variable=_variable;
 if not missing(pvalue) then _pvalue=pvalue;
  else pvalue=_pvalue; 
 retain _test _variable _pvalue;
run;

ods rtf file="/folders/myfolders/test.rtf";
proc report data=all nowd  split='^' spanrows;
column table pos variable  measure a b pvalue order     ;
define table/ group noprint;
define pos/ group noprint;
define variable / group  style(column)=[vjust=middle just=left];
define order/order noprint;
define pvalue/ group  style(column)=[vjust=middle just=left];

define measure / display "Measure" left ;
define a / display center ;
define b /  display center ;


compute before _page_ / left;
line 'xxxxxxxxxxxxxx';
endcomp;
run;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 21 Apr 2016 09:19:56 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-04-21T09:19:56Z</dc:date>
    <item>
      <title>Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265296#M15669</link>
      <description>&lt;P&gt;Hi, How can I merge cells vertically for the first column (i.e. Age, Sex, Height, Weight, BMI) each with different number of rows in proc report? I want the output to look something like the attached photo. I've tried using&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;style(column)=[vjust=middle just=left]&lt;/EM&gt; but it doesn't work.&amp;nbsp;&lt;/SPAN&gt;My codes are below.&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2864iCA67989FB0FEE3AA/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;ods rtf file="C:\User\Desktop\test.rtf";&lt;BR /&gt;proc report data=all nowd spanrows&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;colwidth=10&lt;BR /&gt;spacing=5&lt;BR /&gt;headline headskip split='^'&lt;/P&gt;&lt;P&gt;style(report)=[cellspacing=2 borderwidth=1 bordercolor=black]&lt;BR /&gt;style(header)=[color=blue borderwidth=1 bordercolor=black fontfamily=calibri fontsize=2]&lt;BR /&gt;style(column)=[color=black borderwidth=1 bordercolor=black fontfamily=calibri fontsize=1];&lt;BR /&gt;&lt;BR /&gt;column subgroup table pos order variable&amp;nbsp;measure&amp;nbsp;a b c d;&lt;/P&gt;&lt;P&gt;define subgroup / order order=internal noprint;&lt;BR /&gt;define table / order order=internal noprint;&lt;BR /&gt;define pos / order order=internal noprint;&lt;BR /&gt;define order / order order=internal noprint;&lt;BR /&gt;define &lt;SPAN&gt;variable&lt;/SPAN&gt; / order order=internal display style(column)=[vjust=middle just=left];&lt;BR /&gt;define &lt;SPAN&gt;measure&lt;/SPAN&gt; / display "Measure" left;&lt;BR /&gt;define a&amp;nbsp;/ display center;&lt;BR /&gt;define b&amp;nbsp;/ &amp;nbsp;display center;&lt;BR /&gt;define c&amp;nbsp;/ &amp;nbsp;display center;&lt;BR /&gt;define d&amp;nbsp;/ display center;&lt;BR /&gt;break after subgroup / page;&lt;BR /&gt;compute before _page_ / left;&lt;BR /&gt;line subgroup subgroup.;&lt;BR /&gt;endcomp;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ods rtf close;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 02:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265296#M15669</guid>
      <dc:creator>JoannaL</dc:creator>
      <dc:date>2016-04-21T02:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265306#M15670</link>
      <description>&lt;P&gt;&lt;EM&gt;vjust=center &amp;nbsp;?&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 03:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265306#M15670</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-21T03:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265319#M15671</link>
      <description>&lt;P&gt;It just doesn't work. I still get rows coming out unmerged.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 05:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265319#M15671</guid>
      <dc:creator>JoannaL</dc:creator>
      <dc:date>2016-04-21T05:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265323#M15672</link>
      <description>&lt;P&gt;Then post some data to let us test it .&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 06:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265323#M15672</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-21T06:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265326#M15673</link>
      <description>&lt;P&gt;I have uploaded the data. There are two variable names (variable &amp;amp; varname) which I was testing. vjust(center/middle) doesn't work with either of them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 06:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265326#M15673</guid>
      <dc:creator>JoannaL</dc:creator>
      <dc:date>2016-04-21T06:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265338#M15674</link>
      <description>&lt;P&gt;You have missing value in your group variables.&lt;/P&gt;
&lt;P&gt;And don't define DISPLAY usage for group variable VARIABLE, since it is GROUP usage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile='/folders/myfolders/test.xlsx' dbms=xlsx out=have replace;
run;
data all;
 set have;
 if not missing(test) then _test=test;
  else test=_test;
 if not missing(variable) then _variable=variable;
  else variable=_variable; 
 retain _test _variable;
run;

ods rtf file="/folders/myfolders/test.rtf";
proc report data=all nowd  split='^' spanrows;
column table pos variable order measure a b c d;
define table/ group noprint;
define pos/ group noprint;
define variable / group  style(column)=[vjust=middle just=left];
define order/order noprint;

define measure / display "Measure" left;
define a / display center;
define b /  display center;

compute before _page_ / left;
line 'xxxxxxxxxxxxxx';
endcomp;
run;
ods rtf close;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Apr 2016 07:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265338#M15674</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-21T07:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265359#M15675</link>
      <description>&lt;P&gt;Thanks, KeShan. That works. However, I have another problem. I tried adding another column (pvalue) to the report. But it does not merge as well. I have run the code to retain the pvalues as shown in your example.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=t2 nowd split='^' spanrows;&lt;/P&gt;&lt;P&gt;column table pos variable order measure a b pvalue;&lt;BR /&gt;define table/ group noprint;&lt;BR /&gt;define pos/ group noprint;&lt;BR /&gt;define variable / group style(column)=[vjust=middle just=left];&lt;/P&gt;&lt;P&gt;define order/order noprint;&lt;/P&gt;&lt;P&gt;define measure / display "Measure" left;&lt;BR /&gt;define a / display center;&lt;BR /&gt;define b / display center;&lt;BR /&gt;define pvalue / group style(column)=[vjust=middle just=center];&lt;/P&gt;&lt;P&gt;break after table/page;&lt;BR /&gt;compute before _page_ / left;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;line table table.;&lt;BR /&gt;endcomp;&lt;BR /&gt;run;&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/2867i91AACEFAC8F66C5F/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 09:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265359#M15675</guid>
      <dc:creator>JoannaL</dc:creator>
      <dc:date>2016-04-21T09:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265364#M15676</link>
      <description>&lt;P&gt;Ah.Here is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile='/folders/myfolders/test.xlsx' dbms=xlsx out=have replace;
run;
data all;
 set have;
 if not missing(test) then _test=test;
  else test=_test;
 if not missing(variable) then _variable=variable;
  else variable=_variable;
 if not missing(pvalue) then _pvalue=pvalue;
  else pvalue=_pvalue; 
 retain _test _variable _pvalue;
run;

ods rtf file="/folders/myfolders/test.rtf";
proc report data=all nowd  split='^' spanrows;
column table pos variable  measure a b pvalue order     ;
define table/ group noprint;
define pos/ group noprint;
define variable / group  style(column)=[vjust=middle just=left];
define order/order noprint;
define pvalue/ group  style(column)=[vjust=middle just=left];

define measure / display "Measure" left ;
define a / display center ;
define b /  display center ;


compute before _page_ / left;
line 'xxxxxxxxxxxxxx';
endcomp;
run;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Apr 2016 09:19:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265364#M15676</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-21T09:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265365#M15677</link>
      <description>&lt;P&gt;Thanks so much! So I should conclude that all GROUP&amp;nbsp;variables must be placed before the ORDER&amp;nbsp;variable in the column statement. Else the vertical merge will not work. And there can only be one ORDER variable in a report?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 09:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265365#M15677</guid>
      <dc:creator>JoannaL</dc:creator>
      <dc:date>2016-04-21T09:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Cells Vertically in PROC REPORT RTF</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265367#M15678</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;So I should conclude that all GROUP&amp;nbsp;variables must be placed before the ORDER&amp;nbsp;variable in the column statement. Else the vertical merge will not work."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes. I think so.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"And there can only be one ORDER variable in a report?"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;No. I don't think so. You can take ORDER the same as GROUP. If you replace all the GROUP with ORDER in the code, you will find&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;that still worked.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;PROC REPORT take variables from left to right. So when it meet ORDER variable(order) ,will take it as a GROUP usage variable,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Therefore when variable&amp;nbsp;pvalue after order, PROC REPORT will take ORDER as the first group variable and PVALUE as the second group variable. That is wrong. So you need put PVALUE before ORDER.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 09:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Merging-Cells-Vertically-in-PROC-REPORT-RTF/m-p/265367#M15678</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-21T09:32:51Z</dc:date>
    </item>
  </channel>
</rss>

