<?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: Adding Text to Macro Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-Text-to-Macro-Variable/m-p/486983#M287250</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I have tried EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;iA and EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;i.A&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;You need two dots before the A, because your macro variable begins with two&amp;nbsp;ampersands&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;i..A&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Aug 2018 13:48:48 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-08-15T13:48:48Z</dc:date>
    <item>
      <title>Adding Text to Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Text-to-Macro-Variable/m-p/486981#M287249</link>
      <description>&lt;P&gt;I have the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro byfyear;
	proc sql noprint;
	select distinct fy 
   		into :ifyear1 - :ifyear99
      		from IBS.OVR;
	%let fyearcnt = &amp;amp;sqlobs;
	quit;

	%do i = 1 %to &amp;amp;fyearcnt;
		%if &amp;amp;&amp;amp;ifyear&amp;amp;i = 2017 %then %do;
			data EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;i(where=(fy=&amp;amp;&amp;amp;ifyear&amp;amp;i));
				set IBS.OVR;
			run;
		%end;
		%else %do;
			data EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;i(where=(fy=&amp;amp;&amp;amp;ifyear&amp;amp;i));
				set IBS.OVR;
			run;
		%end;
	%end;
%mend byfyear;
%byfyear&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It works fine. So if the year is 2017 the dataset name will be OVRFY2017. What I would like at&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;&amp;amp;ifyear&amp;amp;i = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2017&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%do&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is to change it so the dataset name appends an A to the file name, so it would be OVRFY2017A. This means I need to add the A to the command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;i(where=(fy=&amp;amp;&amp;amp;ifyear&amp;amp;i));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;specifically the part: EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;i&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do this?&amp;nbsp; I have tried EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;iA and EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;i.A&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;-Bill&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 13:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Text-to-Macro-Variable/m-p/486981#M287249</guid>
      <dc:creator>BCNAV</dc:creator>
      <dc:date>2018-08-15T13:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Text to Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Text-to-Macro-Variable/m-p/486983#M287250</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I have tried EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;iA and EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;i.A&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;You need two dots before the A, because your macro variable begins with two&amp;nbsp;ampersands&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
EGTASK.OVRFY&amp;amp;&amp;amp;ifyear&amp;amp;i..A&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 13:48:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Text-to-Macro-Variable/m-p/486983#M287250</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-08-15T13:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Text to Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Text-to-Macro-Variable/m-p/486984#M287251</link>
      <description>&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 13:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Text-to-Macro-Variable/m-p/486984#M287251</guid>
      <dc:creator>BCNAV</dc:creator>
      <dc:date>2018-08-15T13:49:35Z</dc:date>
    </item>
  </channel>
</rss>

