<?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: Resolving macro variable names stored in a dataset in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626570#M20394</link>
    <description>Can you point me in the direction of some materials on this subject?&lt;BR /&gt;</description>
    <pubDate>Fri, 21 Feb 2020 22:01:00 GMT</pubDate>
    <dc:creator>vickerse333</dc:creator>
    <dc:date>2020-02-21T22:01:00Z</dc:date>
    <item>
      <title>Resolving macro variable names stored in a dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626565#M20392</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm attempting to use macro variables to track versioning in my programs. Ideally, the end product would be an output file with names and version dates for each of my programs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've added a global macro variable to each program that stores the version date. For example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;%LET Prog1_Vsn=%STR(2020.02.21);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with a column for the name of this macro variable, the full program name, and a description. For example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;MacroVar&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Desc&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;amp;Prog1_Vsn&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Program 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;First program in set&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like SAS to create a new variable that resolves the macro variable listed in the dataset, like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;MacroVar&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Desc&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Version&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;amp;Prog1_Vsn&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Program 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;First program in set&amp;nbsp; &amp;nbsp; 2020.02.21&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible? Is there a better way to achieve this result? I'm using base SAS 9.4. Many thanks for any help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS- I do realize that I can hard-code this by using something like IF name = "Program 1" THEN Version = "&amp;amp;Prog1_Vsn". I would like a smarter solution, if at all possible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2020 21:27:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626565#M20392</guid>
      <dc:creator>vickerse333</dc:creator>
      <dc:date>2020-02-21T21:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving macro variable names stored in a dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626569#M20393</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/214858"&gt;@vickerse333&lt;/a&gt;&amp;nbsp; - With all due respect you can build your own version control functionality, but in my experience using a version-control tool with SAS programs is a far better option and is not as complicated as you might think.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2020 21:57:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626569#M20393</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-02-21T21:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving macro variable names stored in a dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626570#M20394</link>
      <description>Can you point me in the direction of some materials on this subject?&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Feb 2020 22:01:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626570#M20394</guid>
      <dc:creator>vickerse333</dc:creator>
      <dc:date>2020-02-21T22:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving macro variable names stored in a dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626571#M20395</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile cards dsd dlm='|' truncover ;
input MacroVar :$32. Name :$50. Desc :$200. ;
cards4;
Prog1_Vsn|Program 1|First program in set
;;;;

%let Prog1_Vsn=2020.02.21;

data want ;
  set have;
  length version $30;
  version=symget(macrovar);
run;

proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    MacroVar       Name               Desc             version

 1     Prog1_Vsn    Program 1    First program in set    2020.02.21
&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Feb 2020 22:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626571#M20395</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-21T22:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving macro variable names stored in a dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626576#M20396</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/214858"&gt;@vickerse333&lt;/a&gt;&amp;nbsp; - If you are using Enterprise Guide, then it works well with Git: &lt;A href="https://documentation.sas.com/?docsetId=egug&amp;amp;docsetTarget=p078cl08fol7hkn11a8nf1f9izq7.htm&amp;amp;docsetVersion=8.2&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=egug&amp;amp;docsetTarget=p078cl08fol7hkn11a8nf1f9izq7.htm&amp;amp;docsetVersion=8.2&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd also advise finding out what version control tools are used in your organisation and trying those out.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2020 22:53:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626576#M20396</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-02-21T22:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving macro variable names stored in a dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626868#M20446</link>
      <description>&lt;P&gt;Symget didn't work. I get lots of error messages like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Invalid argument to function SYMGET('&amp;amp;CM_Ann_Ref_'[12 of 19 characters shown]) at line 456&lt;BR /&gt;column 15.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 13:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626868#M20446</guid>
      <dc:creator>vickerse333</dc:creator>
      <dc:date>2020-02-24T13:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving macro variable names stored in a dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626869#M20447</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/214858"&gt;@vickerse333&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Symget didn't work. I get lots of error messages like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: Invalid argument to function SYMGET('&amp;amp;CM_Ann_Ref_'[12 of 19 characters shown]) at line 456&lt;BR /&gt;column 15.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any other ideas?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SYMGET wants the NAME of the macro variable.&amp;nbsp; Why did you include the ampersand?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 14:08:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626869#M20447</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-24T14:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving macro variable names stored in a dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626870#M20448</link>
      <description>&lt;P&gt;That appears to have been the issue. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 14:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Resolving-macro-variable-names-stored-in-a-dataset/m-p/626870#M20448</guid>
      <dc:creator>vickerse333</dc:creator>
      <dc:date>2020-02-24T14:13:58Z</dc:date>
    </item>
  </channel>
</rss>

