<?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 Tabulate+ods tagsets.excelxp +nested  class variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-ods-tagsets-excelxp-nested-class-variables/m-p/536375#M147397</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I create a summary table via Proc Tabulate.&lt;/P&gt;
&lt;P&gt;I am using ods tagsets.excelxp &amp;nbsp;to export it to excel.&lt;/P&gt;
&lt;P&gt;In the result I want that&amp;nbsp; region and &amp;nbsp;division class variables will be nested (&amp;nbsp;instead of placing them next to each other)&lt;/P&gt;
&lt;P&gt;Why in the excel file that was created I see that region and &amp;nbsp;division are next to each other and not nested?&lt;/P&gt;
&lt;P&gt;Can you provide a code to solve the problem please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Rawtbl;
input ID 1-2 Region$ 4-12 Division$ 13-29  Type 31  expenditures 33-37;
cards;
1  Northeast New England      1 10
2  Northeast Middle Attlantic 1 20 
3  Northeast Middle Attlantic 2 30 
4  Northeast Middle Attlantic 2 40 
5  Northeast New England      2 50
6  West      Mountain         1 50 
7  West      Mountain         1 60 
8  West      Mountain         2 70 
9  West      Pacific          2 80
10 West      Pacific          1 90
11 West      Pacific          2 100 
;
Run;


proc format;
value usetypeFmt
1='Residential customer'
2='Business customer';
Run;


ods tagsets.ExcelXP file="/Path/DavidY1.xls"
   style=Printer
   options(sheet_name="G1"
   absolute_column_width="10" 
   sheet_interval='NONE'
   embedded_titles='yes'
   embedded_footnotes='yes') ;
   options nodate pageno=1 linesize=80 pagesize=60;
proc tabulate data=Rawtbl format=dollar12. noseps;
class region division type;
var expenditures;
table region*division,
          type='Customer Type'*expenditures=' '*sum=' '/ rts=25 indent=4;
format  type usetype.;
title 'Energy Expenditures for Each Region';
title2 '(millions of dollars)';
run;
ods tagsets.excelxp close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Feb 2019 07:38:01 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2019-02-18T07:38:01Z</dc:date>
    <item>
      <title>Proc Tabulate+ods tagsets.excelxp +nested  class variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-ods-tagsets-excelxp-nested-class-variables/m-p/536375#M147397</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I create a summary table via Proc Tabulate.&lt;/P&gt;
&lt;P&gt;I am using ods tagsets.excelxp &amp;nbsp;to export it to excel.&lt;/P&gt;
&lt;P&gt;In the result I want that&amp;nbsp; region and &amp;nbsp;division class variables will be nested (&amp;nbsp;instead of placing them next to each other)&lt;/P&gt;
&lt;P&gt;Why in the excel file that was created I see that region and &amp;nbsp;division are next to each other and not nested?&lt;/P&gt;
&lt;P&gt;Can you provide a code to solve the problem please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Rawtbl;
input ID 1-2 Region$ 4-12 Division$ 13-29  Type 31  expenditures 33-37;
cards;
1  Northeast New England      1 10
2  Northeast Middle Attlantic 1 20 
3  Northeast Middle Attlantic 2 30 
4  Northeast Middle Attlantic 2 40 
5  Northeast New England      2 50
6  West      Mountain         1 50 
7  West      Mountain         1 60 
8  West      Mountain         2 70 
9  West      Pacific          2 80
10 West      Pacific          1 90
11 West      Pacific          2 100 
;
Run;


proc format;
value usetypeFmt
1='Residential customer'
2='Business customer';
Run;


ods tagsets.ExcelXP file="/Path/DavidY1.xls"
   style=Printer
   options(sheet_name="G1"
   absolute_column_width="10" 
   sheet_interval='NONE'
   embedded_titles='yes'
   embedded_footnotes='yes') ;
   options nodate pageno=1 linesize=80 pagesize=60;
proc tabulate data=Rawtbl format=dollar12. noseps;
class region division type;
var expenditures;
table region*division,
          type='Customer Type'*expenditures=' '*sum=' '/ rts=25 indent=4;
format  type usetype.;
title 'Energy Expenditures for Each Region';
title2 '(millions of dollars)';
run;
ods tagsets.excelxp close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 07:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-ods-tagsets-excelxp-nested-class-variables/m-p/536375#M147397</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-02-18T07:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate+ods tagsets.excelxp +nested  class variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-ods-tagsets-excelxp-nested-class-variables/m-p/536613#M147479</link>
      <description>&lt;P&gt;Thanks for supplying all the needed code.&lt;/P&gt;
&lt;P&gt;How nice to be able to just paste and run!&lt;/P&gt;
&lt;P&gt;This works from for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 323px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27272i4BF3CCD32259576C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 542px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27273iC262FD92C10114C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2019 00:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-ods-tagsets-excelxp-nested-class-variables/m-p/536613#M147479</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-02-19T00:43:11Z</dc:date>
    </item>
  </channel>
</rss>

