<?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 in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/563139#M33860</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217142"&gt;@karachi007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Tom, No luck&lt;/P&gt;
&lt;P&gt;this is my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test(DSN):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create connection to ORACLE ,,,,,,,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; create table employee_&amp;amp;DSN. as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; select * from .&amp;amp;DSN. a&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; left join employee e&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; on a.id = e.id;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;%mend test;&lt;/P&gt;
&lt;P&gt;%test(FILE1,FILE2)&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;getting errors:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;more positional parameters found than defined&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please advise and let me know the issue. Thank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The ERROR message is very clear and obvious: you defined the macro with only ONE parameter, and then tried to call it with TWO parameters. This is not possible.&lt;/P&gt;</description>
    <pubDate>Sun, 02 Jun 2019 15:32:01 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-06-02T15:32:01Z</dc:date>
    <item>
      <title>%Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562126#M33810</link>
      <description>&lt;P&gt;I&amp;nbsp; have 2 FILES (FILE1, FILE2) how I read two SAS data sets in my PROC SQL and create two tables for each dataset. I want sepearate output for each file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%MACRO FILE (FILE1, FILE2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql create table tbl.&amp;amp;FILEOUT.&lt;/P&gt;&lt;P&gt;select * from work.&amp;amp;FILE.&lt;/P&gt;&lt;P&gt;; run;&lt;/P&gt;&lt;P&gt;%MEND FILE (FILE1,FILEOUT1,&amp;nbsp; FILE2, FILEOUT2)&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 23:42:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562126#M33810</guid>
      <dc:creator>karachi007</dc:creator>
      <dc:date>2019-05-28T23:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562140#M33811</link>
      <description>&lt;P&gt;You really do have an impossible task here.&amp;nbsp; How do you write a macro to utilize SQL, when you don't know macro language and you don't know SQL?&amp;nbsp; How do you even communicate what is needed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you write a piece of this with no macro language at all.&amp;nbsp; Just get the SQL code working for one file, so you can illustrate what you are trying to do.&amp;nbsp; At that point, you can probably get some help in completing the task.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 02:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562140#M33811</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-05-29T02:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562142#M33813</link>
      <description>&lt;P&gt;sql is very simple: :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;create table out.file1;&lt;/P&gt;&lt;P&gt;select * from file1; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;create table out.file2&lt;/P&gt;&lt;P&gt;select * from file2; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how I write a %macro for file 1 and file 2 as well out.file 1 and out.file2?&lt;/P&gt;&lt;P&gt;%MACRO FILE (FILE1, FILE2);&lt;/P&gt;&lt;P&gt;%MEND (FILE1,FILE2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 02:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562142#M33813</guid>
      <dc:creator>karachi007</dc:creator>
      <dc:date>2019-05-29T02:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562146#M33815</link>
      <description>I want to create separate datasets each file</description>
      <pubDate>Wed, 29 May 2019 03:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562146#M33815</guid>
      <dc:creator>karachi007</dc:creator>
      <dc:date>2019-05-29T03:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562147#M33816</link>
      <description>&lt;P&gt;First step is write code that can run.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table out.FILE1 as
  select * from FILE1
; 
create table out.FILE2 as
  select * from FILE2
; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When that works then the next step is take your working code and replace the variable parts with macro variable references. Use %LET statement to set the values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let ds1=FILE1;
%let ds2=FILE2;

proc sql;
create table out.&amp;amp;ds1. as
  select * from &amp;amp;ds1.
; 
create table out.&amp;amp;ds2. as
  select * from &amp;amp;ds2.
; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that works then you can create a macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro copyfiles(ds1,ds2);
proc sql;
create table out.&amp;amp;ds1. as
  select * from &amp;amp;ds1.
; 
create table out.&amp;amp;ds2. as
  select * from &amp;amp;ds2.
; 
quit;
%mend copyfiles;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then you can call the macro:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%copyfiles(ds1=FILE1,ds2=FILE2)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that if that is what you want to do your macro can generate much simpler code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro copyfiles(ds1,ds2);
proc copy inlib=work outlib=out;
  select &amp;amp;ds1. &amp;amp;ds2. ;
run;
%mend copyfiles;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you could make it more flexible by using a single parameter that can take a space delimited list of member names.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro copyfiles(dslist);
proc copy inlib=work outlib=out;
  select &amp;amp;dslist. ;
run;
%mend copyfiles;
%copyfiles(FILE1 FILE2);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 03:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562147#M33816</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-29T03:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562149#M33817</link>
      <description>&lt;P&gt;Thanks Tom.&lt;/P&gt;&lt;P&gt;This is not what I want all I want&lt;/P&gt;&lt;P&gt;one proc sql execute first with&amp;nbsp; file1 and then file2 and create two separate output for file 1 and file 2 is kind of loop using macro in one sql&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 03:24:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562149#M33817</guid>
      <dc:creator>karachi007</dc:creator>
      <dc:date>2019-05-29T03:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562154#M33818</link>
      <description>We cannot read your mind.&lt;BR /&gt;If you cannot write the code then explain what you want in words. Provide example input data and the expected output for that input data.&lt;BR /&gt;</description>
      <pubDate>Wed, 29 May 2019 04:30:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562154#M33818</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-29T04:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562170#M33819</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217142"&gt;@karachi007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;sql is very simple: :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;create table out.file1;&lt;/P&gt;
&lt;P&gt;select * from file1; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;create table out.file2&lt;/P&gt;
&lt;P&gt;select * from file2; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how I write a %macro for file 1 and file 2 as well out.file 1 and out.file2?&lt;/P&gt;
&lt;P&gt;%MACRO FILE (FILE1, FILE2);&lt;/P&gt;
&lt;P&gt;%MEND (FILE1,FILE2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It might be very simple for us, but your code shows clearly that it is absolutely NOT simple for you, as it is just a sequence of syntax errors.&lt;/P&gt;
&lt;P&gt;So I highly recommend you work through the freely available online Programming 1 course first to get a grasp of the basics of SAS.&lt;/P&gt;
&lt;P&gt;We can (and are glad to) &lt;EM&gt;help&lt;/EM&gt; you with SAS, but &lt;EM&gt;teaching&lt;/EM&gt; SAS in the first place is another matter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have reached the stage where you can write the complete SQL procedure step for one instance, and get it to run error-free, we can show you how to convert it to dynamic code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it was just that you were very sloppy in posting your code, then please post your real, working code for one instance here.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 06:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562170#M33819</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-29T06:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562220#M33821</link>
      <description>&lt;P&gt;Tom thanks for your response.&lt;/P&gt;&lt;P&gt;Just need to run my code using %macro with two data sets like in the loop&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 10:42:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562220#M33821</guid>
      <dc:creator>karachi007</dc:creator>
      <dc:date>2019-05-29T10:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562227#M33822</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217142"&gt;@karachi007&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Macro coding is great for creating dynamic code. But SAS Macro coding is also a recipe to create seriously convoluted and hard to read code. Beginners tend to get too early into SAS Macro coding and often end up with very bad designs and bad code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The details of the questions you ask and the level of code you post indicate that you're a beginner. I'd recommend that you read carefully what some of the senior people here are trying to tell you and how they are trying to guide you to a more "best practice" design and code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But as you insist here what I believe you're asking for.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(in1, out1, in2, out2);
  proc sql;
    create table &amp;amp;out1 as
      select * from &amp;amp;in1
    ;
    create table &amp;amp;out2 as
      select * from &amp;amp;in2
    ;
  quit;
%mend;

%test(sashelp.class, work.class, sashelp.air, work.air)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2019 11:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562227#M33822</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-29T11:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562324#M33823</link>
      <description>No resolution for my problem&lt;BR /&gt;All I need one sql read two files one at a time and create output and reruns sql with file2 and create 2nd output. All I need macro to run the logic&lt;BR /&gt;</description>
      <pubDate>Wed, 29 May 2019 15:45:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562324#M33823</guid>
      <dc:creator>karachi007</dc:creator>
      <dc:date>2019-05-29T15:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562327#M33824</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217142"&gt;@karachi007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;No resolution for my problem&lt;BR /&gt;All I need one sql read two files one at a time and create output and reruns sql with file2 and create 2nd output. All I need macro to run the logic&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please explain what you want to do. Show the code that you need to run.&amp;nbsp; You cannot use a macro to create code until you know what code you want the macro to create.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you think that you need a macro to do what you want to do? Do you plan to do it again at some point?&amp;nbsp; If so what will be different about the future runs?&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 15:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562327#M33824</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-29T15:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562334#M33825</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217142"&gt;@karachi007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;No resolution for my problem&lt;BR /&gt;All I need one sql read two files one at a time and create output and reruns sql with file2 and create 2nd output. All I need macro to run the logic&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are you just asking how to loop over a list of dataset names?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro do_all(dslist);
%local i next;
%do i=1 %to %sysfunc(countw(&amp;amp;dslist,%str( )));
  %let next=%scan(&amp;amp;dslist,&amp;amp;i,%str( ));
   .... code that references macro variable &amp;amp;NEXT ....
%end;
%mend do_all;
%do_all(file1 file2 anotherfile)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2019 16:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562334#M33825</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-29T16:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562344#M33826</link>
      <description>Tom,&lt;BR /&gt;I have a code like this:&lt;BR /&gt;Proc sql;&lt;BR /&gt;connect to database&lt;BR /&gt;create table test.&amp;amp;outputfile. as&lt;BR /&gt;select * from&lt;BR /&gt;work.&amp;amp;file1. a&lt;BR /&gt;Left join oracletable b&lt;BR /&gt;On a.id =b.id&lt;BR /&gt;&lt;BR /&gt;I need to run same sql with File1,,,File10&lt;BR /&gt;and create 10 output datasets for each file&lt;BR /&gt;I will be running this code 100 times&lt;BR /&gt;with multiple databases&lt;BR /&gt;That’s why I need to use macro&lt;BR /&gt;Hope you understand the logic now</description>
      <pubDate>Wed, 29 May 2019 16:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562344#M33826</guid>
      <dc:creator>karachi007</dc:creator>
      <dc:date>2019-05-29T16:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562376#M33828</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217142"&gt;@karachi007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Tom,&lt;BR /&gt;I have a code like this:&lt;BR /&gt;Proc sql;&lt;BR /&gt;connect to database&lt;BR /&gt;create table test.&amp;amp;outputfile. as&lt;BR /&gt;select * from&lt;BR /&gt;work.&amp;amp;file1. a&lt;BR /&gt;Left join oracletable b&lt;BR /&gt;On a.id =b.id&lt;BR /&gt;&lt;BR /&gt;I need to run same sql with File1,,,File10&lt;BR /&gt;and create 10 output datasets for each file&lt;BR /&gt;I will be running this code 100 times&lt;BR /&gt;with multiple databases&lt;BR /&gt;That’s why I need to use macro&lt;BR /&gt;Hope you understand the logic now&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Follow the steps in my first post on this thread to write a macro to implement that code for one input/output pair.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then either call the macro many times.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or better get your list of 100's of datasets into a dataset and use a data step it to generate multiple calls to the macro.&amp;nbsp; You can use CALL EXECUTE() or simple write the macro calls to a text file use PUT statement and then use %INCLUDE to run the generated calls.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 18:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562376#M33828</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-29T18:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562434#M33829</link>
      <description>&lt;P&gt;Tom, No luck&lt;/P&gt;&lt;P&gt;this is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro test(DSN):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create connection to ORACLE ,,,,,,,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; create table employee_&amp;amp;DSN. as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select * from .&amp;amp;DSN. a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; left join employee e&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; on a.id = e.id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;run;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;%test(FILE1,FILE2)&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;getting errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;more positional parameters found than defined&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please advise and let me know the issue. Thank&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 23:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/562434#M33829</guid>
      <dc:creator>karachi007</dc:creator>
      <dc:date>2019-05-29T23:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/563113#M33857</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217142"&gt;@karachi007&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is a common beginners problem to try and use SAS Macro language for a problem that should be addressed differently. It's much better to first better skill up in normal SAS language before even attempting to use SAS Macro language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe we could give you better advice if you can tell us what bigger problem you want to solve. Share the bigger picture with us? What do you have to start with, what do you need as target state and where you're stuck and need help with? - A description of the problem like: A bunch of SAS tables in a source library to be loaded into same named tables in Oracle. Dynamic code required to just pick-up whatever tables are in source. Succeeded to write the load code for a single table but don't manage to make the code dynamic.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2019 03:02:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/563113#M33857</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-06-02T03:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: %Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/563139#M33860</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217142"&gt;@karachi007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Tom, No luck&lt;/P&gt;
&lt;P&gt;this is my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test(DSN):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create connection to ORACLE ,,,,,,,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; create table employee_&amp;amp;DSN. as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; select * from .&amp;amp;DSN. a&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; left join employee e&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; on a.id = e.id;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;%mend test;&lt;/P&gt;
&lt;P&gt;%test(FILE1,FILE2)&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;getting errors:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;more positional parameters found than defined&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please advise and let me know the issue. Thank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The ERROR message is very clear and obvious: you defined the macro with only ONE parameter, and then tried to call it with TWO parameters. This is not possible.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2019 15:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/563139#M33860</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-02T15:32:01Z</dc:date>
    </item>
  </channel>
</rss>

