<?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: macro data set name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442359#M282722</link>
    <description>&lt;P&gt;Please put yourself in the position of someone who does not know your intentions or your code, and then read your post. Would you be able to make any sense of it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post code and log, example data (data step!), and either point to the ERROR/WARNING or, in the case of (on the surface) working code, where the result differs from your expectations.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Mar 2018 14:15:15 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-03-05T14:15:15Z</dc:date>
    <item>
      <title>macro data set name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442356#M282721</link>
      <description>&lt;P&gt;I want to create sequences of sas data set macros&lt;/P&gt;&lt;P&gt;for example &amp;amp;site&amp;nbsp; is a subset of site&amp;nbsp;&lt;/P&gt;&lt;P&gt;then I want to create &amp;amp;site1 which is the subset of &amp;amp;site&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; then &amp;amp;site2 which is a subset of &amp;amp;site1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know what is the best way to do it, bc when I tried to do it this way &amp;amp;&amp;amp;site1&lt;/P&gt;&lt;P&gt;it shows error in the log&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%let site=site; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;PROC IMPORT OUT=&amp;amp;site&lt;BR /&gt;DATAFILE= "&amp;amp;Path1"&lt;BR /&gt;            DBMS=XLSX REPLACE;&lt;BR /&gt;     run; &lt;/PRE&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;data &amp;amp;&amp;amp;site1; &lt;BR /&gt;set &amp;amp;site; &lt;BR /&gt;run;&lt;/PRE&gt;&lt;DIV class="sasSource"&gt;92 &amp;amp;site1&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;&lt;DIV class="sasError"&gt;22&lt;/DIV&gt;&lt;DIV class="sasError"&gt;200&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, /, ;, _DATA_, _LAST_, _NULL_.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 14:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442356#M282721</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2018-03-05T14:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: macro data set name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442359#M282722</link>
      <description>&lt;P&gt;Please put yourself in the position of someone who does not know your intentions or your code, and then read your post. Would you be able to make any sense of it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post code and log, example data (data step!), and either point to the ERROR/WARNING or, in the case of (on the surface) working code, where the result differs from your expectations.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 14:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442359#M282722</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-05T14:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: macro data set name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442382#M282723</link>
      <description>&lt;P&gt;This: "&lt;/P&gt;
&lt;PRE&gt;data &amp;amp;&amp;amp;site1; &lt;BR /&gt;set &amp;amp;site; &lt;BR /&gt;run;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;Is never going to end well.&amp;nbsp; Import your data, then apply your groupings&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;in one dataset&lt;/STRONG&gt;&lt;/U&gt;.&amp;nbsp; Never split data into multiple datasets unless there is a very good reason (and there rarely is).&amp;nbsp; Also don't put data - in this case site - in dataset names or variables, these are for programming.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 15:00:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442382#M282723</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-03-05T15:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: macro data set name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442396#M282724</link>
      <description>&lt;P&gt;Instead of&lt;/P&gt;
&lt;PRE&gt;data &amp;amp;&amp;amp;site1; 
set &amp;amp;site; 
run;&lt;/PRE&gt;
&lt;P&gt;try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data &amp;amp;site.1; 
set &amp;amp;site; 
run;&lt;/PRE&gt;
&lt;P&gt;Though I agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;about splitting data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reason: when SAS encounters something like &amp;amp;&amp;amp;Site1 it "holds" the first &amp;amp; and tries to resolve "&amp;amp;site1" and then resolve the&amp;nbsp;resulting&amp;nbsp;&amp;amp;site1. Suppose you had a macro variable Site1 with the value of ABC. Then &amp;amp;&amp;amp;site1 by steps becomes&amp;amp;(&amp;amp;site1) becomes&amp;nbsp;&amp;amp;ABC. So SAS would expect a macro variable named ABC and use the value of that variable.&lt;/P&gt;
&lt;P&gt;The &amp;amp;site.1&amp;nbsp;, pay attention to the period says "resolve the macro variable site and append 1 to the value".&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 15:32:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442396#M282724</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-05T15:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: macro data set name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442407#M282725</link>
      <description>&lt;P&gt;How did you expect the SAS macro processor to interpret these lines?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &amp;amp;&amp;amp;site1; 
  set &amp;amp;site; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That is what lines of actual SAS code did you expect to result after the macro variable references were replaced?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What will resolve to in pseudo code is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &amp;lt;value of macro variable SITE1&amp;gt;; 
  set &amp;lt;value of macro variable SITE&amp;gt;; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If instead you wanted to append the constant text 1 to the end of the value of SITE you need to let the macro processor know where you macro variable name ends and your constant text begins.&amp;nbsp; You use a period for that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data &amp;amp;site.1; 
  set &amp;amp;site; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that means if the constant text starts with a period you will need to type two of them. One for the macro processor and one for SAS.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set &amp;amp;site; 
  file "outfile_&amp;amp;site..txt" dsd ;
  put (_all_) (+0);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 16:10:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-data-set-name/m-p/442407#M282725</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-05T16:10:55Z</dc:date>
    </item>
  </channel>
</rss>

