<?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 How Do I Use Sheet_Interval with Macro Variables in a Proc Surveyfreq? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-Do-I-Use-Sheet-Interval-with-Macro-Variables-in-a-Proc/m-p/250471#M56588</link>
    <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I would like to use the ODS tagsets&amp;nbsp;sheet_interval option&amp;nbsp;with a macro variable to create separate&amp;nbsp;sheets for a frequency&amp;nbsp;of each variable within the macro. For example, here&amp;nbsp;I want separate&amp;nbsp;tabs showing the values by year and state for "make," "model," and "color":&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET varlist = make model color;

ODS tagsets.ExcelXP BODY = "C:\Mypath\myfile.xml";

ODS tagsets.ExcelXP options(sheet_interval='&amp;amp;varlist' absolute_column_width=&amp;amp;COL width_fudge='0.6' embedded_titles='Yes' sheet_name="");

PROC SURVEYFREQ DATA=mydata;&lt;BR /&gt;TABLES year*state*(&amp;amp;varlist) / ROW CL;
WEIGHT mywgt;
RUN;

ODS tagsets.ExcelXP CLOSE;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Right now,&amp;nbsp;this code gives my a file with a separate tab for every table&amp;nbsp;combination (e.g.one tab for the "make" table where year=2011 and state=alabama; one for the "make" table where year=2011 and state=alaska; etc.). Ideally, it would separate JUST on the macro variables so one "make" tab will have the cross-sections of every make by year and state - three tabs in total. Can someone help me see what I'm doing wrong?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thanks! I'm using SAS 9.4.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Feb 2016 23:12:14 GMT</pubDate>
    <dc:creator>sas_vegas</dc:creator>
    <dc:date>2016-02-16T23:12:14Z</dc:date>
    <item>
      <title>How Do I Use Sheet_Interval with Macro Variables in a Proc Surveyfreq?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-Do-I-Use-Sheet-Interval-with-Macro-Variables-in-a-Proc/m-p/250471#M56588</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I would like to use the ODS tagsets&amp;nbsp;sheet_interval option&amp;nbsp;with a macro variable to create separate&amp;nbsp;sheets for a frequency&amp;nbsp;of each variable within the macro. For example, here&amp;nbsp;I want separate&amp;nbsp;tabs showing the values by year and state for "make," "model," and "color":&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET varlist = make model color;

ODS tagsets.ExcelXP BODY = "C:\Mypath\myfile.xml";

ODS tagsets.ExcelXP options(sheet_interval='&amp;amp;varlist' absolute_column_width=&amp;amp;COL width_fudge='0.6' embedded_titles='Yes' sheet_name="");

PROC SURVEYFREQ DATA=mydata;&lt;BR /&gt;TABLES year*state*(&amp;amp;varlist) / ROW CL;
WEIGHT mywgt;
RUN;

ODS tagsets.ExcelXP CLOSE;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Right now,&amp;nbsp;this code gives my a file with a separate tab for every table&amp;nbsp;combination (e.g.one tab for the "make" table where year=2011 and state=alabama; one for the "make" table where year=2011 and state=alaska; etc.). Ideally, it would separate JUST on the macro variables so one "make" tab will have the cross-sections of every make by year and state - three tabs in total. Can someone help me see what I'm doing wrong?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thanks! I'm using SAS 9.4.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 23:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-Do-I-Use-Sheet-Interval-with-Macro-Variables-in-a-Proc/m-p/250471#M56588</guid>
      <dc:creator>sas_vegas</dc:creator>
      <dc:date>2016-02-16T23:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Use Sheet_Interval with Macro Variables in a Proc Surveyfreq?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-Do-I-Use-Sheet-Interval-with-Macro-Variables-in-a-Proc/m-p/250478#M56589</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are getting a sheet per each table as the default. I might expect you to get a message as '&amp;amp;varlist' doesn't resolve your variables would not be valid options for sheet_interval which can be Table, Page, Bygroup, Proc, and None.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I want to control output in the manner you are suggesting I would suggest sending the desired output to datasets using ODS OUTPUT and then using another report procedure that would allow use of year and state as either page variables with the PAGE interval or by variables and the BYGROUP sheet interval.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2016 00:29:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-Do-I-Use-Sheet-Interval-with-Macro-Variables-in-a-Proc/m-p/250478#M56589</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-02-17T00:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: How Do I Use Sheet_Interval with Macro Variables in a Proc Surveyfreq?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-Do-I-Use-Sheet-Interval-with-Macro-Variables-in-a-Proc/m-p/250706#M56612</link>
      <description>&lt;P&gt;Thank you! I will try an an approach like that - do you know if there is a way to get the output to format in a manner similar to what is provided by the default surveyfreq procedure as below?&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/1919i4346667076D742D4/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="state_make_year.png" title="state_make_year.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2016 20:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-Do-I-Use-Sheet-Interval-with-Macro-Variables-in-a-Proc/m-p/250706#M56612</guid>
      <dc:creator>sas_vegas</dc:creator>
      <dc:date>2016-02-17T20:42:58Z</dc:date>
    </item>
  </channel>
</rss>

