<?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 Multiple macro variables in a title in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Multiple-macro-variables-in-a-title/m-p/722674#M224113</link>
    <description>&lt;P&gt;How can I create a title based on the values of several macros&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have&lt;/P&gt;
&lt;P&gt;%let &amp;nbsp;name = Mary;&lt;/P&gt;
&lt;P&gt;%let id = 10021;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let key = Z;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want my title to look like this (MaryID10021KeyZ)&lt;/P&gt;
&lt;P&gt;How can I make this in the titles statement?&lt;/P&gt;</description>
    <pubDate>Mon, 01 Mar 2021 20:30:42 GMT</pubDate>
    <dc:creator>gleebglorb</dc:creator>
    <dc:date>2021-03-01T20:30:42Z</dc:date>
    <item>
      <title>Multiple macro variables in a title</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-macro-variables-in-a-title/m-p/722674#M224113</link>
      <description>&lt;P&gt;How can I create a title based on the values of several macros&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have&lt;/P&gt;
&lt;P&gt;%let &amp;nbsp;name = Mary;&lt;/P&gt;
&lt;P&gt;%let id = 10021;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let key = Z;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want my title to look like this (MaryID10021KeyZ)&lt;/P&gt;
&lt;P&gt;How can I make this in the titles statement?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 20:30:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-macro-variables-in-a-title/m-p/722674#M224113</guid>
      <dc:creator>gleebglorb</dc:creator>
      <dc:date>2021-03-01T20:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Macros in a title</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-macro-variables-in-a-title/m-p/722676#M224115</link>
      <description>&lt;P&gt;Multiple macro VARIABLEs in a title are perfectly fine. &lt;BR /&gt;This may generate what you want. You may find yourself with leading/trailing spaces issues though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: note that I added in the periods. It's needed for the ID variable otherwise, SAS cannot tell if the macro variable is ID or IDKEY.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A period at the end of the macro variable name tells SAS that is the end of name and it can be resolved correctly..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "&amp;amp;name.&amp;amp;ID.Key&amp;amp;Key.";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;In that case, it really depends on how you're creating your macro variables. If you can use CALL SYMPUTX() or TRIMMED option in SQL, that's the easiest way to remove the trailing/leading spaces but again, it depends on how you're creating the macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FYI - I modified your subject line to specify macro variables not macros. There is a significant difference between the two and it's important to be specific for future searches.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UCLA introductory tutorial on macro variables and macros&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/" target="_blank" rel="noopener"&gt;https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Tutorial on converting a working program to a macro&lt;BR /&gt;&lt;BR /&gt;This method is pretty robust and helps prevent errors and makes it much easier to debug your code. Obviously biased, because I wrote it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md" target="_blank" rel="noopener"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Examples of common macro usage&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/370741"&gt;@gleebglorb&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;How can I create a title based on the values of several macros&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have&lt;/P&gt;
&lt;P&gt;%let &amp;nbsp;name = Mary;&lt;/P&gt;
&lt;P&gt;%let id = 10021;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let key = Z;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want my title to look like this (MaryID10021KeyZ)&lt;/P&gt;
&lt;P&gt;How can I make this in the titles statement?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 20:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-macro-variables-in-a-title/m-p/722676#M224115</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-01T20:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple macro variables in a title</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-macro-variables-in-a-title/m-p/722684#M224119</link>
      <description>&lt;P&gt;Perhaps with a slight modification to add ID in the middle:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "(&amp;amp;name.ID&amp;amp;id.Key&amp;amp;key.)";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This variation supposes that the parentheses are supposed to be part of the title.&amp;nbsp; Take them out if they aren't needed.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 20:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-macro-variables-in-a-title/m-p/722684#M224119</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-03-01T20:41:39Z</dc:date>
    </item>
  </channel>
</rss>

