<?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: Taking substring from the name of the variable macro in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84859#M9107</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, This could be completely off-topic without knowing your purpose. But SAS stores all of the Macro variable name in : dictionary.macros (only for sql) or sashelp.vmacro. From there you can just treat them as regular text strings and apply many powerful parsing functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jan 2013 19:48:39 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2013-01-24T19:48:39Z</dc:date>
    <item>
      <title>Taking substring from the name of the variable macro</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84855#M9103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to now if is it possible take a substr from the variable macro's name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let Test = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I'd like to do a substr from the name "Test", Is it possible ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tk's in advanced!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 14:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84855#M9103</guid>
      <dc:creator>Abud</dc:creator>
      <dc:date>2013-01-24T14:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Taking substring from the name of the variable macro</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84856#M9104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use the substr function to extract the part of the string. however when you use the sas function in macro variable we should use %sysfunc(). like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let test=%str(good day);&lt;/P&gt;&lt;P&gt;%put &amp;amp;test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let first=%sysfunc(substr(&amp;amp;test,1,4));&lt;/P&gt;&lt;P&gt;%put &amp;amp;first;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However for your question as per the post you should change the code this way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let test=0;&lt;/P&gt;&lt;P&gt;%put &amp;amp;test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let first=%sysfunc(substr(&amp;amp;test,1,1));&lt;/P&gt;&lt;P&gt;%put &amp;amp;first;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 15:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84856#M9104</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-01-24T15:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Taking substring from the name of the variable macro</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84857#M9105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can substring the variable name, but you'd need to know it before hand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let test=0;&lt;/P&gt;&lt;P&gt;%put &amp;amp;test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let first=%sysfunc(substr(test,1,1));&lt;/P&gt;&lt;P&gt;%put &amp;amp;first;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're looking to substring the value of your macro variable then Jagadish's solution will work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 15:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84857#M9105</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-01-24T15:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Taking substring from the name of the variable macro</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84858#M9106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the macro language has a %substr function.&lt;/P&gt;&lt;P&gt;%Let Mvar = value;&lt;/P&gt;&lt;P&gt;%Let part = %substr(&amp;amp;Mvar,1,2);&lt;/P&gt;&lt;P&gt;%put note: part: &amp;amp;Part.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;note: part: va&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The way I read your Q you want to get a substring of a macro variable name;&lt;/P&gt;&lt;P&gt;that does not compute. What could you do with that info?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; macro maven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 17:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84858#M9106</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2013-01-24T17:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Taking substring from the name of the variable macro</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84859#M9107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, This could be completely off-topic without knowing your purpose. But SAS stores all of the Macro variable name in : dictionary.macros (only for sql) or sashelp.vmacro. From there you can just treat them as regular text strings and apply many powerful parsing functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 19:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Taking-substring-from-the-name-of-the-variable-macro/m-p/84859#M9107</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-01-24T19:48:39Z</dc:date>
    </item>
  </channel>
</rss>

