<?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: Using macro to name a data file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-to-name-a-data-file/m-p/23291#M3847</link>
    <description>I just saw your reply and thank you for your reply, Cynthia!</description>
    <pubDate>Fri, 21 May 2010 20:59:11 GMT</pubDate>
    <dc:creator>SAS_user_n</dc:creator>
    <dc:date>2010-05-21T20:59:11Z</dc:date>
    <item>
      <title>Using macro to name a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-to-name-a-data-file/m-p/23289#M3845</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I am trying to use the following macro to name my data file but it is not working but not sure why. It gets stuck on "&lt;B&gt;data temp_&amp;amp;yymm._seg&amp;amp;i&lt;/B&gt;". It seems to get stuck due to having 2 macro variables in the file name. &lt;BR /&gt;
&lt;BR /&gt;
Could I get some help? Thank you.&lt;BR /&gt;
================================&lt;BR /&gt;
%macro name_data(yymm=,i=);&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;data temp_&amp;amp;yymm_seg&amp;amp;i ;&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
       merge     data1_seg&amp;amp;i (in=a) &lt;BR /&gt;
                     &lt;B&gt;data2_&amp;amp;yymm_seg&amp;amp;i (in=b);&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
       by common_var;&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
%mend name_data;</description>
      <pubDate>Mon, 17 May 2010 18:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-to-name-a-data-file/m-p/23289#M3845</guid>
      <dc:creator>SAS_user_n</dc:creator>
      <dc:date>2010-05-17T18:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro to name a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-to-name-a-data-file/m-p/23290#M3846</link>
      <description>Actually, there is a HUGE difference between:&lt;BR /&gt;
&lt;B&gt;temp_&amp;amp;yymm._seg&amp;amp;i&lt;/B&gt; as a macro variable reference (with the dot[.] ) and  &lt;B&gt;temp_&amp;amp;yymm_seg&amp;amp;i&lt;/B&gt; without the dot [.] in the name.&lt;BR /&gt;
 &lt;BR /&gt;
Your code does NOT show the dot. I would suspect that you are getting messages something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
WARNING: Apparent symbolic reference YYMM_SEG not resolved.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
Or something similar if you do NOT have a single dot that shows the macro processor where one macro variable ends and the rest of the string begins. If you need to have a dot in a resolved macro variable name, such as you needed to build a dataset name from 2 macro variables, then you use 2 dots -- one dot for the delimiter and the second dot as part of the resolved value, like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let lib = perm;&lt;BR /&gt;
%let myfile = cars;&lt;BR /&gt;
     &lt;BR /&gt;
proc print data=&amp;amp;lib.&amp;amp;myfile  &amp;lt;---would be wrong&lt;BR /&gt;
proc print data=&amp;amp;lib..&amp;amp;myfile &amp;lt;---would be correct&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                     &lt;BR /&gt;
For more information about macro variable concatenation to build text strings from multiple macro variables, consult the macro documentation. In addition, this paper is a good introduction to macro processing concepts.&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi28/056-28.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi28/056-28.pdf&lt;/A&gt; &lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 17 May 2010 18:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-to-name-a-data-file/m-p/23290#M3846</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-05-17T18:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro to name a data file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-to-name-a-data-file/m-p/23291#M3847</link>
      <description>I just saw your reply and thank you for your reply, Cynthia!</description>
      <pubDate>Fri, 21 May 2010 20:59:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-to-name-a-data-file/m-p/23291#M3847</guid>
      <dc:creator>SAS_user_n</dc:creator>
      <dc:date>2010-05-21T20:59:11Z</dc:date>
    </item>
  </channel>
</rss>

