<?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: Append Formats and Labels dynamically through Macro call in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Append-Formats-and-Labels-dynamically-through-Macro-call/m-p/799030#M314145</link>
    <description>&lt;P&gt;You only defined the macro variable varName.&lt;/P&gt;
&lt;P&gt;But in the later macro calls you are trying to reference other macro variables with longer names, varName_ae_v.&lt;/P&gt;
&lt;P&gt;To tell the macro processor where the name of the macro variable ends use a period.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%AppendFormatToCatalog(&amp;amp;varName._ae_v, ct_ae_v_formats, ct_ae_v_labels);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 27 Feb 2022 23:42:10 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-02-27T23:42:10Z</dc:date>
    <item>
      <title>Append Formats and Labels dynamically through Macro call</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-Formats-and-Labels-dynamically-through-Macro-call/m-p/799028#M314144</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a %macro that appends the Labels and Formats to my data files - it works flawlessly if I hard-code the file names.&amp;nbsp; &amp;nbsp;I need it to be more dynamic.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;** THIS CODE WORKS **&lt;/P&gt;&lt;PRE&gt;%AppendFormatToCatalog(ct14547_0222_ae_v, ct_ae_v_formats, ct_ae_v_labels);
%AppendFormatToCatalog(ct14547_0222_inf_v, ct_inf_v_formats, ct_inf_v_labels);&lt;BR /&gt;...&lt;BR /&gt;..    * 6 more like these;&lt;BR /&gt;.&lt;/PRE&gt;&lt;P&gt;** THIS CODE FAILS **&lt;/P&gt;&lt;PRE&gt;%let varName = ct14547_0222;

%AppendFormatToCatalog(&amp;amp;varName_ae_v, ct_ae_v_formats, ct_ae_v_labels);
%AppendFormatToCatalog(&amp;amp;varName_inf_v, ct_inf_v_formats, ct_inf_v_labels);&lt;BR /&gt;...&lt;BR /&gt;.. * 6 more like these;&lt;BR /&gt;.&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;We get new studies every week and the study file formats are exactly the same each week - with a different name. If I choose to hard-code the study name everything works, but the name ct14547_0222 is referenced like 30 times in my script.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use the "%let varName = ct14547_0222;" bit at the top of my code I can get my script to work *except* for this series of macro calls.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I get "&amp;amp;varName_ae_v" to resolve to "ct14547_0222_ae_v" in a parameter call so it sends the correct parameter to the macro?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Feb 2022 22:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-Formats-and-Labels-dynamically-through-Macro-call/m-p/799028#M314144</guid>
      <dc:creator>tdegen</dc:creator>
      <dc:date>2022-02-27T22:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Append Formats and Labels dynamically through Macro call</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-Formats-and-Labels-dynamically-through-Macro-call/m-p/799030#M314145</link>
      <description>&lt;P&gt;You only defined the macro variable varName.&lt;/P&gt;
&lt;P&gt;But in the later macro calls you are trying to reference other macro variables with longer names, varName_ae_v.&lt;/P&gt;
&lt;P&gt;To tell the macro processor where the name of the macro variable ends use a period.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%AppendFormatToCatalog(&amp;amp;varName._ae_v, ct_ae_v_formats, ct_ae_v_labels);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Feb 2022 23:42:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-Formats-and-Labels-dynamically-through-Macro-call/m-p/799030#M314145</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-27T23:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Append Formats and Labels dynamically through Macro call</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-Formats-and-Labels-dynamically-through-Macro-call/m-p/799159#M314215</link>
      <description>&lt;P&gt;Did your log show any notes about undefined macro variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is your first step, read the log. When you don't understand what the log is telling you then copy the message text with the code generating the message you don't understand and post that in a text box on the forum.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 16:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-Formats-and-Labels-dynamically-through-Macro-call/m-p/799159#M314215</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-28T16:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Append Formats and Labels dynamically through Macro call</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-Formats-and-Labels-dynamically-through-Macro-call/m-p/799173#M314222</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&amp;nbsp;Issue resolved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to admit that after reading your response at first I thought I hadn't explained my issue adequately.&amp;nbsp; &amp;nbsp;But I did a little digging on macro variables and the dot ( . ) suffix.&amp;nbsp; Your assessment was, of course, 100% correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was the second page I looked at:&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/When-is-proper-time-to-add-dot-after-macro-variables/m-p/404458" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/When-is-proper-time-to-add-dot-after-macro-variables/m-p/404458&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only mention the URL above as it addresses the flaw outside the bounds of today's issue and will change how I declare and use variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for correcting my issue and turning me onto a more permanent solution for handling macro variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 16:41:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-Formats-and-Labels-dynamically-through-Macro-call/m-p/799173#M314222</guid>
      <dc:creator>tdegen</dc:creator>
      <dc:date>2022-02-28T16:41:50Z</dc:date>
    </item>
  </channel>
</rss>

