<?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: SAS Macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Executing-SAS-macros-from-command-line/m-p/262626#M310175</link>
    <description>&lt;P&gt;Are the files macros or programs? &amp;nbsp; A macro doesn't really do anything until it is invoked. &amp;nbsp;It sounds like you are taking about a series of programs instead of macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If they really are macros then perhaps you want to look into using an AUTOCALL library. &amp;nbsp;Store each macro definition in its own file with the filename being the name of the macro plus an&amp;nbsp;extenson of .sas (if you use Unix is important that the fllename be in all lowercase letters). Then point the SASAUTOS option to the directory where the macro code files are stored. &amp;nbsp;SAS will then read the flle and compile the macro the first time it is requested in your actual program. &amp;nbsp;So for example you could have a file named 'a.sas' that looked like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro A;
%put Macro A will now call macro B;
%B;
%mend A;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And another file named 'b.sas' that looked like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro B;
%put Macro B is running now;
%mend B;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could then create a program that looked something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put Now running my program ;
options append=sasautos=('path to where macro source code lives');
%A;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or since you seem to have an AUTOEXEC.SAS file you could put&amp;nbsp;the SASAUTOS option setting into the autoexec file.&lt;/P&gt;</description>
    <pubDate>Sat, 09 Apr 2016 01:08:25 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2016-04-09T01:08:25Z</dc:date>
    <item>
      <title>Executing SAS macros from command line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Executing-SAS-macros-from-command-line/m-p/262623#M310174</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a some macros, say, A to E, executed in that order (A calls B, C, D and E). Each macro is in a separate .SAS file(say, Macro A is in A.sas, B in B.sas and so on).&amp;nbsp;The&amp;nbsp;parameters&amp;nbsp;passed to the macros and those used in the macros are stored in a SAS dataset (central table).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to write a UNIX shell script that compiles the macros at run time as Stored Compiled Macros (I included the /STORE syntax in macros) and executes them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My shell script:&lt;/P&gt;
&lt;P&gt;#!/bin/bash&lt;/P&gt;
&lt;P&gt;sas -AUTOEXEC "/sasdata/autoexec/project_autoexec.sas" &amp;nbsp;A.sas B.sas C.sas D.sas E.sas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also tried using separate lines for each .sas file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sas -AUTOEXEC "/sasdata/autoexec/&lt;/SPAN&gt;&lt;SPAN&gt;project_&lt;/SPAN&gt;&lt;SPAN&gt;autoexec.sas" &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;A.sas&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sas B.sas&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;......&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sas E.sas&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I am getting errors. Can some one help me ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Apr 2016 00:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Executing-SAS-macros-from-command-line/m-p/262623#M310174</guid>
      <dc:creator>KrisNori</dc:creator>
      <dc:date>2016-04-09T00:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Executing-SAS-macros-from-command-line/m-p/262626#M310175</link>
      <description>&lt;P&gt;Are the files macros or programs? &amp;nbsp; A macro doesn't really do anything until it is invoked. &amp;nbsp;It sounds like you are taking about a series of programs instead of macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If they really are macros then perhaps you want to look into using an AUTOCALL library. &amp;nbsp;Store each macro definition in its own file with the filename being the name of the macro plus an&amp;nbsp;extenson of .sas (if you use Unix is important that the fllename be in all lowercase letters). Then point the SASAUTOS option to the directory where the macro code files are stored. &amp;nbsp;SAS will then read the flle and compile the macro the first time it is requested in your actual program. &amp;nbsp;So for example you could have a file named 'a.sas' that looked like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro A;
%put Macro A will now call macro B;
%B;
%mend A;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And another file named 'b.sas' that looked like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro B;
%put Macro B is running now;
%mend B;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could then create a program that looked something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put Now running my program ;
options append=sasautos=('path to where macro source code lives');
%A;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or since you seem to have an AUTOEXEC.SAS file you could put&amp;nbsp;the SASAUTOS option setting into the autoexec file.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Apr 2016 01:08:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Executing-SAS-macros-from-command-line/m-p/262626#M310175</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-04-09T01:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SAS macros from command line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Executing-SAS-macros-from-command-line/m-p/262662#M310176</link>
      <description>"I'm getting errors". Any idea how we could help without seeing the errors, or your SAS program...?</description>
      <pubDate>Sat, 09 Apr 2016 11:33:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Executing-SAS-macros-from-command-line/m-p/262662#M310176</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-04-09T11:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Executing SAS macros from command line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Executing-SAS-macros-from-command-line/m-p/262814#M310177</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/53251"&gt;@KrisNori&lt;/a&gt; wrote:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I am getting errors. Can some one help me ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yeah. And a bicycle was stolen in Beijing.&lt;/P&gt;
&lt;P&gt;Which, as information goes, is about as relevant to your problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post the relevant parts of your log files, if you get any. Or the operating system's response when you executed your command lines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If macro A.sas contains valid %include statements for the other macros, you only need to execute A.sas.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 06:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Executing-SAS-macros-from-command-line/m-p/262814#M310177</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-11T06:31:57Z</dc:date>
    </item>
  </channel>
</rss>

