<?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 question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629591#M186212</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; This is very helpful and I will reach out to the original programmer and find out if he can send me the Marco setup file. Thank you all again, your continuous help and support make my SAS learning possible.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Mar 2020 20:03:17 GMT</pubDate>
    <dc:creator>zimcom</dc:creator>
    <dc:date>2020-03-04T20:03:17Z</dc:date>
    <item>
      <title>Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629574#M186201</link>
      <description>&lt;P&gt;Greeting!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I receieved a SAS program codes which has a few Marco statements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%setup;&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;%sumcat5(datin=adqs3, clsvar=trt01pn, byvars=avisitn, anvar=aval);&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the code, I got the following warning and error message when I come to the above Marco statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;WARNING: Apparent invocation of macro SETUP not resolved.&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know much about the Marco, I want to know how I can run the code and what is missing&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629574#M186201</guid>
      <dc:creator>zimcom</dc:creator>
      <dc:date>2020-03-04T19:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629577#M186202</link>
      <description>&lt;P&gt;&lt;SPAN&gt;%setup&amp;nbsp; is a macro call that you would use to execute compiled macro code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Do you know whether &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%macro setup;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-------&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-----&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%mend setup;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Has been compiled previously ?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629577#M186202</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-04T19:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629579#M186203</link>
      <description>&lt;P&gt;I dont know, but how?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629579#M186203</guid>
      <dc:creator>zimcom</dc:creator>
      <dc:date>2020-03-04T19:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629580#M186204</link>
      <description>&lt;P&gt;Somewhere you need to find the code that define the macro setup. Then compile that before running the code you show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code would look something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro setup();&lt;/P&gt;
&lt;P&gt;&amp;lt;a bunch of statements&amp;gt;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Highlight the code and then run it to compile the macro. You may need to do this for other macro definitions as well.&lt;/P&gt;
&lt;P&gt;If you can't find that definition code go back to the source and search or inquire about the definition code.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:44:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629580#M186204</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-04T19:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629582#M186205</link>
      <description>&lt;P&gt;Before you can call %SETUP you need to define it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most likely the original user was using autocall facility to have SAS find and compile the macro source.&amp;nbsp; You can set the SASAUTOS option to point to one or more directories and when SAS does not already have a macro with the name your code is using, say SETUP, defined it will look for a file with the same name as the macro, so 'setup.sas',&amp;nbsp; in the SASAUTOS search path and include the code in that file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or there might be one large file that defines all of the macros that the program assumed had already been run when the SAS session was started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So look for the code that starts with %MACRO SETUP and ends with %MEND statement.&amp;nbsp; That is the definition or the macro.&amp;nbsp; If you run that code it should just compile the macro so that is available to be called.&amp;nbsp; Once the macro is defined your other code can use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629582#M186205</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-04T19:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629583#M186206</link>
      <description>&lt;P&gt;Hmm, you would need to find out the location where the macro is stored/saved. Perhaps, you could ask your teammates/or even boss? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629583#M186206</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-04T19:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629584#M186207</link>
      <description>&lt;P&gt;So I need to go back to the original SAS programmer who initially wrote this SAS program to ask for Marco setup code?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:47:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629584#M186207</guid>
      <dc:creator>zimcom</dc:creator>
      <dc:date>2020-03-04T19:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629587#M186208</link>
      <description>&lt;P&gt;Yes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the name it sounds like they have system of macros they have created.&amp;nbsp; So the SETUP macro will set your SAS session into the standard environment that they like to use.&amp;nbsp; Probably defining standard libref, filerefs, options etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully they have documentation of how they work and how you can use them.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:50:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629587#M186208</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-04T19:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629591#M186212</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; This is very helpful and I will reach out to the original programmer and find out if he can send me the Marco setup file. Thank you all again, your continuous help and support make my SAS learning possible.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 20:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629591#M186212</guid>
      <dc:creator>zimcom</dc:creator>
      <dc:date>2020-03-04T20:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629655#M186258</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Before you can call %SETUP you need to define it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most likely the original user was using autocall facility to have SAS find and compile the macro source.&amp;nbsp; You can set the SASAUTOS option to point to one or more directories and when SAS does not already have a macro with the name your code is using, say SETUP, defined it will look for a file with the same name as the macro, so 'setup.sas',&amp;nbsp; in the SASAUTOS search path and include the code in that file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or there might be one large file that defines all of the macros that the program assumed had already been run when the SAS session was started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So look for the code that starts with %MACRO SETUP and ends with %MEND statement.&amp;nbsp; That is the definition or the macro.&amp;nbsp; If you run that code it should just compile the macro so that is available to be called.&amp;nbsp; Once the macro is defined your other code can use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A Comment I often place in my code that uses some of my custom utility macros is that the macros are in a folder that has been added to the Autocall path on my system. So folks that come after me when I strike it rich at the lottery have some chance of finding the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course they may have to find my Autoexec.SAS file to find that path ...&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 23:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629655#M186258</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-04T23:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629658#M186260</link>
      <description>Thanks for the insight, after today’s discussion I kind of have an idea of Marco code now. I have requested from the original programmer for the marco code. I am solo SAS user in the entire company and I learned a lot of things from here, I just want to say that I appreciated your help so much !!!</description>
      <pubDate>Wed, 04 Mar 2020 23:48:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629658#M186260</guid>
      <dc:creator>zimcom</dc:creator>
      <dc:date>2020-03-04T23:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629835#M186368</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;sumcat5&lt;/EM&gt;&lt;/STRONG&gt;(datin=adqs3, clsvar=trt01pn, byvars=avisitn, anvar=aval);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"Yes, that summarizes the data and puts it in a format for the .rtf file. It is not required for the proc logistic analysis. You can get the summary statistics &lt;STRONG&gt;by replacing it with a proc freq.&lt;/STRONG&gt;"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I got reply and not quite sure how to replace the above marco with a proc freq, would you be able to provide any insight on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 15:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629835#M186368</guid>
      <dc:creator>zimcom</dc:creator>
      <dc:date>2020-03-05T15:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629859#M186381</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/219549"&gt;@zimcom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;sumcat5&lt;/EM&gt;&lt;/STRONG&gt;(datin=adqs3, clsvar=trt01pn, byvars=avisitn, anvar=aval);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"Yes, that summarizes the data and puts it in a format for the .rtf file. It is not required for the proc logistic analysis. You can get the summary statistics &lt;STRONG&gt;by replacing it with a proc freq.&lt;/STRONG&gt;"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I got reply and not quite sure how to replace the above marco with a proc freq, would you be able to provide any insight on this?&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;You need to ask more or figure out what output you want .&amp;nbsp; Looks like you might use the DATIN value as the DATA= value, BYVARS values on a BY statement, CLSVAR and ANVAR in the TABLES statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=adqs3 ;
  by avisitn;
  tables trt01pn*aval;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Mar 2020 16:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-question/m-p/629859#M186381</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-05T16:14:32Z</dc:date>
    </item>
  </channel>
</rss>

