<?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 proc sql using macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-using-macros/m-p/11993#M1227</link>
    <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
I have 30 different datasets in SAS and I would like to merge each one of them with a standard one I have. I am trying to write a macro to do that automatically for me. Unfortunately my macro (see below) does not work and I am not sure why this is the case. I get an error message:&lt;BR /&gt;
&lt;BR /&gt;
WARNING: Apparent symbolic reference DISEASE_CLINIC not resolved.&lt;BR /&gt;
ERROR 22-322: Expecting a name.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro merge(disease=);&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table test.&amp;amp;disease_clinic as&lt;BR /&gt;
select *&lt;BR /&gt;
from test.clinical_diagnosis left join test.&amp;amp;disease&lt;BR /&gt;
on clinical_diagnosis.medcode=&amp;amp;disease.medcode;&lt;BR /&gt;
quit;&lt;BR /&gt;
%mend merge;&lt;BR /&gt;
%merge (disease=tia);&lt;BR /&gt;
&lt;BR /&gt;
Any ideas would be greatly appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
A</description>
    <pubDate>Mon, 13 Jun 2011 15:44:59 GMT</pubDate>
    <dc:creator>Aspa</dc:creator>
    <dc:date>2011-06-13T15:44:59Z</dc:date>
    <item>
      <title>proc sql using macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-using-macros/m-p/11993#M1227</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
I have 30 different datasets in SAS and I would like to merge each one of them with a standard one I have. I am trying to write a macro to do that automatically for me. Unfortunately my macro (see below) does not work and I am not sure why this is the case. I get an error message:&lt;BR /&gt;
&lt;BR /&gt;
WARNING: Apparent symbolic reference DISEASE_CLINIC not resolved.&lt;BR /&gt;
ERROR 22-322: Expecting a name.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro merge(disease=);&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table test.&amp;amp;disease_clinic as&lt;BR /&gt;
select *&lt;BR /&gt;
from test.clinical_diagnosis left join test.&amp;amp;disease&lt;BR /&gt;
on clinical_diagnosis.medcode=&amp;amp;disease.medcode;&lt;BR /&gt;
quit;&lt;BR /&gt;
%mend merge;&lt;BR /&gt;
%merge (disease=tia);&lt;BR /&gt;
&lt;BR /&gt;
Any ideas would be greatly appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
A</description>
      <pubDate>Mon, 13 Jun 2011 15:44:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-using-macros/m-p/11993#M1227</guid>
      <dc:creator>Aspa</dc:creator>
      <dc:date>2011-06-13T15:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql using macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-using-macros/m-p/11994#M1228</link>
      <description>I think the problem is in the line:&lt;BR /&gt;
&lt;BR /&gt;
create table test.&amp;amp;disease_clinic as&lt;BR /&gt;
&lt;BR /&gt;
SAS is expecting a macro variable named Disease_clinic to have been defined.&lt;BR /&gt;
If you are wanting to use the name of the variable concatenated with _clinic the syntax should be:&lt;BR /&gt;
create table test.&amp;amp;disease._clinic as&lt;BR /&gt;
 &lt;BR /&gt;
SAS uses a period to indicate the end of the macro variable name when used in compounds such as this.</description>
      <pubDate>Mon, 13 Jun 2011 16:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-using-macros/m-p/11994#M1228</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-06-13T16:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql using macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-using-macros/m-p/11995#M1229</link>
      <description>You'll have the same issues in your column references too.  E.g.:&lt;BR /&gt;
&lt;BR /&gt;
clinical_diagnosis.medcode=&amp;amp;disease.medcode;&lt;BR /&gt;
&lt;BR /&gt;
If the macro variable &amp;amp;disease computes to "ALPHA" then this would be equivalent to:&lt;BR /&gt;
&lt;BR /&gt;
clinical_diagnosis.medcode=ALPHAmedcode;&lt;BR /&gt;
&lt;BR /&gt;
If you're using the macro variable to reference a table name, then simply add a second dot, so&lt;BR /&gt;
&lt;BR /&gt;
clinical_diagnosis.medcode=&amp;amp;disease..medcode;&lt;BR /&gt;
&lt;BR /&gt;
Would become&lt;BR /&gt;
&lt;BR /&gt;
clinical_diagnosis.medcode=ALPHA.medcode;</description>
      <pubDate>Tue, 14 Jun 2011 16:50:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-using-macros/m-p/11995#M1229</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2011-06-14T16:50:43Z</dc:date>
    </item>
  </channel>
</rss>

