<?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: Simple Macro Discussion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217313#M40031</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unless you have someone dictating a policy to use 2 digit years in file/dataset names I would strongly recommend consider naming the original datasets as neds2009merge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you don't have to calculate such things as 20+&amp;amp;year. Also it will make looping over datasets with macros or using call execute easier:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%do year=2008 %to 2012;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data=data.neds&amp;amp;year.merge1;&lt;/P&gt;&lt;P&gt;&amp;lt;other common code&amp;gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;for a rough example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 May 2015 22:52:37 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-05-19T22:52:37Z</dc:date>
    <item>
      <title>Simple Macro Discussion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217311#M40029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a simple macro question; if anyone has better sources to read up on macros, I would also appreciate it (I've been reading up a bit on google, but can't seem to find my error here)&lt;/P&gt;&lt;P&gt;I have two datasets called: data.neds09merge1 and data.neds10merge1&lt;/P&gt;&lt;P&gt;I want to add a variable for each year (2009, 2010) for the corresponding data sets above. So Data.neds09merge1 will have 2009 for everyone in the variable "year," and data.neds10merge1 will have 2010 for everyone in the variable "year."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, I want "yearz" to be 09 or 10, corresponding to the 2009 and 2010.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So basically I'm trying to do this but make a macro for it&lt;/P&gt;&lt;P&gt;data one;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set data.neds09merge1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year = 2009;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data two;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set data.neds10merge1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year = 2010;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but for some reason my macro is giving me trouble.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;%Macro stack(set,yearz);&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; data &amp;amp;set;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; set data.neds&amp;amp;&amp;amp;year&amp;amp;merge1;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; year = 20&amp;amp;yearz;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;%mend stack;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;%stack(set = one, year = 09);&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;%stack(set = two, year = 10); &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;The error I get:&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;WARNING: Apparent symbolic reference MERGE not resolved.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;I think it has something to do with the &amp;amp; after "year" and preceding "merge1." I'm not 100% sure though. Thoughts?Thanks! -Gina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 20:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217311#M40029</guid>
      <dc:creator>ginak</dc:creator>
      <dc:date>2015-05-19T20:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Macro Discussion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217312#M40030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't have a macro variable &amp;amp;merge1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You also seem to have spelling differences, in one place the macro variable is yearz, and other places it is &amp;amp;year&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set data.neds&amp;amp;yearz.merge1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 20:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217312#M40030</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-05-19T20:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Macro Discussion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217313#M40031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unless you have someone dictating a policy to use 2 digit years in file/dataset names I would strongly recommend consider naming the original datasets as neds2009merge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you don't have to calculate such things as 20+&amp;amp;year. Also it will make looping over datasets with macros or using call execute easier:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%do year=2008 %to 2012;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data=data.neds&amp;amp;year.merge1;&lt;/P&gt;&lt;P&gt;&amp;lt;other common code&amp;gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;for a rough example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 22:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217313#M40031</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-05-19T22:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Macro Discussion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217314#M40032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%macro stack(set,year);&lt;/P&gt;&lt;P&gt;data &amp;amp;set;&lt;/P&gt;&lt;P&gt;set data.neds&amp;amp;year.merge1; *the dot after year terminates the macro variable name and signals to the macro interpreter that the following constitutes "plain" program text not to be treated by it;&lt;/P&gt;&lt;P&gt;year = 20&amp;amp;year;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%stack(one,09);&lt;/P&gt;&lt;P&gt;%stack(two,10);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 05:29:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217314#M40032</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-05-20T05:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Macro Discussion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217315#M40033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not entirely sure what the point of the macro and all the code is.&amp;nbsp; Why not just do:&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;neds09merge1 (in=a) &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;neds10merge1 (in=b);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if a then year=2009;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else year=2010;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 08:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-Macro-Discussion/m-p/217315#M40033</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-20T08:40:35Z</dc:date>
    </item>
  </channel>
</rss>

