<?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: Macro to call different years of data in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-call-different-years-of-data/m-p/487047#M31524</link>
    <description>&lt;P&gt;2016 is not a valid SAS name. Please show how your datasets are really named.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Aug 2018 15:45:05 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-15T15:45:05Z</dc:date>
    <item>
      <title>Macro to call different years of data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-call-different-years-of-data/m-p/487040#M31521</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently have a program that outputs a new data set that contains results of the proc surveyfreq procedure below:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyfreq data=2016;
weight finalwt;&lt;BR /&gt;table (gender grade age race hhincome)*(eversmk cursmk)/ cl row nocellpct nostd nofreq nowt nototal;
ods output CrossTabs=table1;&lt;BR /&gt;&lt;BR /&gt;data table1;&lt;BR /&gt;retain gender grade age race hhincome eversmk cursmk RowPercent RowLowerCL RowUpperCL;
set table1(drop=F_cursmk LowerCL UpperCL Table _SkipLine);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would like to develop a macro that calls in different years of data instead of repeating the same surveyfreq procedure&amp;nbsp;on each year of data I have. The above program is for 2016 data, but I would like a macro that calls in 2015, 2014, etc and outputs the same resulting statistics.&amp;nbsp;I have little experience with developing macro code, so any advice would be appreciated. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 15:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-call-different-years-of-data/m-p/487040#M31521</guid>
      <dc:creator>sfw_09</dc:creator>
      <dc:date>2018-08-15T15:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to call different years of data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-call-different-years-of-data/m-p/487043#M31522</link>
      <description>&lt;P&gt;You can create a macro variable like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year=2016;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have all the years in one data set, you can combine this with a where statement like so:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyfreq data-yourdata;
    where year=&amp;amp;year;
    other code;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Unless there's a reason you need it to be separate you may be better off by using a BY statement instead though. Then you would just run the proc once, and get all of your output in one place.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyfreq data=yourdata;
    BY year;
    other code;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Aug 2018 15:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-call-different-years-of-data/m-p/487043#M31522</guid>
      <dc:creator>cau83</dc:creator>
      <dc:date>2018-08-15T15:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to call different years of data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-call-different-years-of-data/m-p/487047#M31524</link>
      <description>&lt;P&gt;2016 is not a valid SAS name. Please show how your datasets are really named.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 15:45:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-call-different-years-of-data/m-p/487047#M31524</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-15T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to call different years of data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-call-different-years-of-data/m-p/487096#M31530</link>
      <description>&lt;P&gt;1) combine the data sets&lt;/P&gt;
&lt;P&gt;2) make sure you have two variables with the year value for each of the data sets&lt;/P&gt;
&lt;P&gt;3) One of those variables goes on a STRATA statement&lt;/P&gt;
&lt;P&gt;4) the Other Year variable goes in your tables statement to get a summary by year. (can't have a variable on the strata statement as a tables variables)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No macro needed&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 17:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-call-different-years-of-data/m-p/487096#M31530</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-15T17:51:53Z</dc:date>
    </item>
  </channel>
</rss>

