<?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: Nesting Headers in Proc Report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Nesting-Headers-in-Proc-Report/m-p/702580#M215190</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;COLUMN RaceCd N
("Average Pressures" (SBP DBP),(MEAN STD));
DEFINE SBP / FORMAT= 5.1 "Systolic";
DEFINE DBP / "Diastolic";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would suggest naming Systolic and Diastolic in the DEFINE statements so you don't have too many things in the COLUMN statement. I nested my headers a little bit differently from the other user who responded and it ends up being the same. The headings should be listed with the heading that includes the most variables first, and so on. So the "Average Pressures" should be listed before the variables that it will be heading, then SBP and DBP are listed, then the values underneath those. I also used a FORMAT for RaceCd.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2020 15:11:45 GMT</pubDate>
    <dc:creator>abrice520</dc:creator>
    <dc:date>2020-12-10T15:11:45Z</dc:date>
    <item>
      <title>Nesting Headers in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-Headers-in-Proc-Report/m-p/702236#M215084</link>
      <description>&lt;P&gt;Hi SAS communities,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to summarize blood pressure by race, and I need my data to look like this (font, size doesn't matter):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sasquestion1.3.png" style="width: 273px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52076i5FB80722D22DAF9C/image-size/large?v=v2&amp;amp;px=999" role="button" title="sasquestion1.3.png" alt="sasquestion1.3.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This is my current code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SORT&lt;BR /&gt;DATA = Hypanl.noformatshyp2&lt;BR /&gt;OUT = WORK.noformatshyp2;&lt;BR /&gt;TITLE "Blood Pressure Summaries by Race";&lt;BR /&gt;BY RaceCd;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;PROC REPORT DATA = Hypanl.noformatshyp2 SPLIT = '/';&lt;BR /&gt;COLUMN RaceCd N (SBP DBP),(MEAN STD)&lt;BR /&gt;("Average Pressures"&lt;BR /&gt;("Systolic" SBP)&lt;BR /&gt;("Diastolic" DBP));&lt;BR /&gt;DEFINE RaceCd / GROUP 'Race Code';&lt;BR /&gt;DEFINE SBP / ANALYSIS MEAN FORMAT = 5.1 STD FORMAT = 4.1 'Systolic';&lt;BR /&gt;DEFINE DBP / FORMAT= 4.1 'Diastolic' ;&lt;BR /&gt;RBREAK AFTER / SUMMARIZE;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a picture of the code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sasquestion1.2.png" style="width: 724px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52075i9ECAC1AE2F99DDFA/image-size/large?v=v2&amp;amp;px=999" role="button" title="sasquestion1.2.png" alt="sasquestion1.2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And this is the result I am getting. I am not sure why I have another section of "Average Pressures" with blood pressure data underneath. I am thinking I nested the headers incorrectly, but I am not sure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sasquestion1.png" style="width: 388px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52074i1B06CA677A7834D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="sasquestion1.png" alt="sasquestion1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2020 04:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-Headers-in-Proc-Report/m-p/702236#M215084</guid>
      <dc:creator>mdakkak</dc:creator>
      <dc:date>2020-11-29T04:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting Headers in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-Headers-in-Proc-Report/m-p/702283#M215091</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/344368"&gt;@mdakkak&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/344368"&gt;@mdakkak&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am not sure why I have another section of "Average Pressures" with blood pressure data underneath.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is because of the second mention of SBP and DBP in the COLUMN statement. Note that you also duplicate the headers "Systolic" and "Diastolic" by specifying them both in the COLUMN and in the DEFINE statements. Just insert the spanning header into the existing pair of parentheses around "SBP DBP."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, the second FORMAT= specification in the DEFINE statement for SBP overrides the first (and even that of the&amp;nbsp;&lt;SPAN&gt;DEFINE statement for DBP). If you really needed to format means and standard deviations separately, you would use DEFINE statements for the statistics (and for aliases of the statistics if all four were to be formatted separately).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Usually a category like "&lt;EM&gt;Other&lt;/EM&gt; Race" is sorted last. Depending on the internal values of &lt;FONT face="courier new,courier"&gt;RaceCd&lt;/FONT&gt;, the specification &lt;FONT face="courier new,courier"&gt;ORDER=internal&lt;/FONT&gt; can achieve this, but your PROC SORT step suggests that you actually wanted to use dataset WORK.noformatshyp2 in the PROC REPORT step and the option&amp;nbsp;&lt;FONT face="courier new,courier"&gt;ORDER=data&lt;/FONT&gt; for variable &lt;FONT face="courier new,courier"&gt;RaceCd&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REPORT DATA = WORK.noformatshyp2;
COLUMN RaceCd N ("Average Pressures" SBP DBP),(MEAN STD);
DEFINE RaceCd / GROUP 'Race Code' ORDER=data;
DEFINE SBP / FORMAT = 5.1 'Systolic';
DEFINE DBP / 'Diastolic';
RBREAK AFTER / SUMMARIZE;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 29 Nov 2020 11:22:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-Headers-in-Proc-Report/m-p/702283#M215091</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-11-29T11:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting Headers in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-Headers-in-Proc-Report/m-p/702580#M215190</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;COLUMN RaceCd N
("Average Pressures" (SBP DBP),(MEAN STD));
DEFINE SBP / FORMAT= 5.1 "Systolic";
DEFINE DBP / "Diastolic";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would suggest naming Systolic and Diastolic in the DEFINE statements so you don't have too many things in the COLUMN statement. I nested my headers a little bit differently from the other user who responded and it ends up being the same. The headings should be listed with the heading that includes the most variables first, and so on. So the "Average Pressures" should be listed before the variables that it will be heading, then SBP and DBP are listed, then the values underneath those. I also used a FORMAT for RaceCd.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 15:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-Headers-in-Proc-Report/m-p/702580#M215190</guid>
      <dc:creator>abrice520</dc:creator>
      <dc:date>2020-12-10T15:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting Headers in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nesting-Headers-in-Proc-Report/m-p/705836#M216574</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your column statement should be written as the following! You can rename SBP and DBP using the define statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;title "Blood Pressure Summaries by Race";&lt;BR /&gt;proc report data=hw;&lt;BR /&gt;&lt;STRONG&gt;column RaceCd N ("Average Pressures" SBP DBP ), (MEAN STD) ;&lt;/STRONG&gt;&lt;BR /&gt;define RaceCd / group ;&lt;BR /&gt;define SBP / ANALYSIS MEAN STD format= 4.1 "Systolic";&lt;BR /&gt;define DBP / ANALYSIS MEAN STD format= 4.1 "Diastolic";&lt;BR /&gt;format RaceCd $RaceCdf.;&lt;BR /&gt;rbreak After/ Summarize;&lt;BR /&gt;run;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2020 20:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nesting-Headers-in-Proc-Report/m-p/705836#M216574</guid>
      <dc:creator>patrickjharvey</dc:creator>
      <dc:date>2020-12-14T20:21:23Z</dc:date>
    </item>
  </channel>
</rss>

