<?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: Insert the parameter of a macro at the beginning of a variable or dataset name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Insert-the-parameter-of-a-macro-at-the-beginning-of-a-variable/m-p/95941#M20170</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. In fact, the problem was the . between the two terms.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Dec 2012 02:40:23 GMT</pubDate>
    <dc:creator>Demographer</dc:creator>
    <dc:date>2012-12-11T02:40:23Z</dc:date>
    <item>
      <title>Insert the parameter of a macro at the beginning of a variable or dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-the-parameter-of-a-macro-at-the-beginning-of-a-variable/m-p/95939#M20168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to create variables and dataset with a macro. Part of the name of those is one of the parameter of this macro.&lt;/P&gt;&lt;P&gt;When the parameter is located at the end of the name, it works.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test(year);&lt;/P&gt;&lt;P&gt;data work.bd&amp;amp;year;&lt;/P&gt;&lt;P&gt;variable&amp;amp;years=variable;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test(2007);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I do the same, but with the parameter at the beginningof the name? This doesn't work because the parameter is not recognise:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test(year);&lt;/P&gt;&lt;P&gt;data work.&amp;amp;yearbd;&lt;/P&gt;&lt;P&gt;&amp;amp;yearvariable=variable;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test(2007);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2012 01:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-the-parameter-of-a-macro-at-the-beginning-of-a-variable/m-p/95939#M20168</guid>
      <dc:creator>Demographer</dc:creator>
      <dc:date>2012-12-11T01:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Insert the parameter of a macro at the beginning of a variable or dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-the-parameter-of-a-macro-at-the-beginning-of-a-variable/m-p/95940#M20169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first letter of a dataset name or variable can't be a digit, it is illegal.&lt;/P&gt;&lt;P&gt;I don't understand why would you want do that.You can use a underline before it to make it legal.&lt;/P&gt;&lt;P&gt;or use options validvarname=any ; to make it happen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options validvarname=any ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test(year);&lt;/P&gt;&lt;P&gt;data work.&lt;STRONG&gt;_&amp;amp;year.&lt;/STRONG&gt;bd ;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"&amp;amp;year.variable"n&lt;/STRONG&gt;=1; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test(2007);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2012 02:30:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-the-parameter-of-a-macro-at-the-beginning-of-a-variable/m-p/95940#M20169</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-12-11T02:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Insert the parameter of a macro at the beginning of a variable or dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-the-parameter-of-a-macro-at-the-beginning-of-a-variable/m-p/95941#M20170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. In fact, the problem was the . between the two terms.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2012 02:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-the-parameter-of-a-macro-at-the-beginning-of-a-variable/m-p/95941#M20170</guid>
      <dc:creator>Demographer</dc:creator>
      <dc:date>2012-12-11T02:40:23Z</dc:date>
    </item>
  </channel>
</rss>

