<?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: A question about using customer-defined macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114896#M23668</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, guys:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the responses. However, it still doesn't work if I remove the word sasautos in the parentness. I did so before, since I don't want to overwrite the default sas auto libraries. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 May 2012 19:37:47 GMT</pubDate>
    <dc:creator>bigbigben</dc:creator>
    <dc:date>2012-05-14T19:37:47Z</dc:date>
    <item>
      <title>A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114891#M23663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have a question about how to use customer-defined macros stored in a local directory. I learn that there are two methods: specify the "autocall macro libraries" or use %include to inclue an external file. Both of them look easy. However, I have no problem with the second method, but never worked the first out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I saved some written macros as .sas file in a directory. For example, in the directory D:\work\sasfiles, there is a file named xxx.sas. Inside the file, there is just a simple macro defined:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro xxx;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;command lines&amp;gt;&lt;/P&gt;&lt;P&gt;%mend xxx;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then write the following lines in the main program :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options sasautos=("D:\work\sasfiles" sasautos);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%xxx;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As long as I run the main progrm, there is an error message: Warning: Apparent invocation of macro xxx not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, If I write&lt;/P&gt;&lt;P&gt;%include "D:\work\sasfiles\xxx.sas";&lt;/P&gt;&lt;P&gt;%xxx;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code runs perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My understanding is that I only need to specify a directory for the auto libraries (sasautos). This is what I want, since I have multiple macros saved in the same directory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I work with SAS9.2 in a unix enviroment.&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 18:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114891#M23663</guid>
      <dc:creator>bigbigben</dc:creator>
      <dc:date>2012-05-14T18:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114892#M23664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try adding&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mautosource in options&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 19:21:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114892#M23664</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-05-14T19:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114893#M23665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I change the code as:&lt;/P&gt;&lt;P&gt;options mprint sasautos=( "D:\work\sasfiles\xxx.sas" sasautos ) mautosource;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, it does not work, either.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 19:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114893#M23665</guid>
      <dc:creator>bigbigben</dc:creator>
      <dc:date>2012-05-14T19:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114894#M23666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Since LinLin has answered your question, I will just pick on you a little:&lt;/P&gt;&lt;P&gt;You said: "I learn that there are two methods". &lt;/P&gt;&lt;P&gt;Not quite. There are actually another way to store and run customer-defined macros. You can compile-store and then call the compiled macro to run. comparing to the two methods you mentioned, this is most efficient to run a macro repeatedly (and more secure if you don't want your code being seen by other users). Search SAS help for details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 19:29:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114894#M23666</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-05-14T19:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114895#M23667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're correct to use options sasautos=&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But remove the second "sasautos" from inside the parentheses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 19:31:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114895#M23667</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-14T19:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114896#M23668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, guys:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the responses. However, it still doesn't work if I remove the word sasautos in the parentness. I did so before, since I don't want to overwrite the default sas auto libraries. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 19:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114896#M23668</guid>
      <dc:creator>bigbigben</dc:creator>
      <dc:date>2012-05-14T19:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114897#M23669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I use PC sas.&lt;/P&gt;&lt;P&gt;first I saved the code below at 'C:\TEMP\forum' as plast.sas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro plast;&lt;/P&gt;&lt;P&gt; data class;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; proc print data=&amp;amp;syslast;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt; %mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I call the macro by:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; options &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;mautosource&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;sasautos&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=(&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'C:\TEMP\forum'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,sasautos);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;plast&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 20:10:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114897#M23669</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-05-14T20:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114898#M23670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ben, your code does look correct but ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You say you are running on Unix.&amp;nbsp; Yet the path in quotes is a path on the PC.&amp;nbsp; Do you have some sort of hybrid environment where the Unix machine can't find the folder?&amp;nbsp; Are you getting any error messages related to the OPTIONS statement?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 20:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114898#M23670</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-14T20:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114899#M23671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may have to try something like this on Unix:&lt;/P&gt;&lt;P&gt;options sasautos=('/my/unix/directory', '!SASROOT/sasautos');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...or try assigning it to a FILENAME first:&lt;/P&gt;&lt;P&gt;filename mylib "d:\work\sasfiles\xxx.sas";&lt;/P&gt;&lt;P&gt;options sasautos=(sasautos, mylib);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure if the order maters, but I always specify the sasautos fileref first, then a local fileref.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also...there's a note in the documentation about SASAUTOS not recognizing upper case or mixed case filenames in Unix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/00/444.html"&gt;http://support.sas.com/kb/00/444.html&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 20:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114899#M23671</guid>
      <dc:creator>JasonDiVirgilio</dc:creator>
      <dc:date>2012-05-14T20:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: A question about using customer-defined macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114900#M23672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Try this...&lt;/P&gt;&lt;P&gt;first code: and save it.&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;%let USER_UMACRO_PATH =F:\Community_SAS;&lt;/P&gt;&lt;P&gt;%put &amp;amp;USER_UMACRO_PATH;&lt;/P&gt;&lt;P&gt;options sasautos=("&amp;amp;USER_UMACRO_PATH" %sysfunc(getoption(SASAUTOS)));&lt;/P&gt;&lt;P&gt; %mend test;&lt;/P&gt;&lt;P&gt;Second go to sasv9.cfg file and add you autocall library path(see the last line i have modified):&lt;/P&gt;&lt;P&gt;-SET SASAUTOS&amp;nbsp; (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\core\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\assist\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\eis\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\ets\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\graph\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\iml\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\or\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\qc\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\share\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "!sasext0\stat\sasmacro"&lt;/P&gt;&lt;P&gt;&amp;nbsp; "F:\Community_SAS"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;Now close sas editor and reopen the new one and check by invoking the macro...&lt;/P&gt;&lt;P&gt;%test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 03:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-question-about-using-customer-defined-macros/m-p/114900#M23672</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-05-15T03:42:58Z</dc:date>
    </item>
  </channel>
</rss>

