<?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: writing macro code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/writing-macro-code/m-p/11627#M1112</link>
    <description>I showed you an example.&lt;BR /&gt;
&lt;BR /&gt;
From there, you should be able to see, or figure out, what you want to do yourself.&lt;BR /&gt;
&lt;BR /&gt;
The universal thing to do is not use a macro and just use the title and footnote statements directly themselves.  Otherwise, you will just create an overly complicated wrapper that doesn't simplify anything.&lt;BR /&gt;
&lt;BR /&gt;
Like I just wrote in another thread.&lt;BR /&gt;
&lt;BR /&gt;
KISS -- keep it simple ...&lt;BR /&gt;
&lt;BR /&gt;
macro's are meant to simplify and condense/modularize reusable code.&lt;BR /&gt;
&lt;BR /&gt;
Like %getID and %getPassword(%getID)&lt;BR /&gt;
&lt;BR /&gt;
Where %getID is&lt;BR /&gt;
&lt;BR /&gt;
%macro getID;&lt;BR /&gt;
  %lowcase(%sysget(USERNAME))&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
and %getPassword retrieves a user's password from a secure table, which consumes a number of lines of code.&lt;BR /&gt;
&lt;BR /&gt;
Another way I use a macro is for database access.&lt;BR /&gt;
&lt;BR /&gt;
I have a macro that has all the pieces to access our MOM data warehouse.  I use it in two ways:&lt;BR /&gt;
1)  in an include file that has the following line&lt;BR /&gt;
[pre]&lt;BR /&gt;
  libname MOM oledb %MOMdb ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
2) to facilitate pass-through SQL&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  connect to oledb as momdb (%momdb) ;&lt;BR /&gt;
 &lt;BR /&gt;
  ...&lt;BR /&gt;
 &lt;BR /&gt;
  disconnect from momdb;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
%momdb returns all of the datasource=, provider=, user=, password=, schema= and prompt=no bits and pieces, providing a single point of maintenance should something have to change.&lt;BR /&gt;
&lt;BR /&gt;
Now it would be useless for me to write a generic universal %momdb statement for you to use because the bits and pieces would be different.  Same goes for a common title and footer thingy.</description>
    <pubDate>Thu, 17 Apr 2008 18:13:12 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-04-17T18:13:12Z</dc:date>
    <item>
      <title>writing macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-macro-code/m-p/11624#M1109</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
Will some one help me out in writing a macro code.&lt;BR /&gt;
While generating a report in PDF format you normally write a SAS code which includes titles and foot notes also.How do you write a macro code  for titles and foot notes exclusively such that when you run the SAS code(which does not include titles and foot notes) along with the macro (which contains the code for titles and footnotes),the  combined output should reflect titles and foot notes also.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.&lt;BR /&gt;
SAS community member.</description>
      <pubDate>Thu, 17 Apr 2008 15:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-macro-code/m-p/11624#M1109</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-04-17T15:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: writing macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-macro-code/m-p/11625#M1110</link>
      <description>Macros are code generators.&lt;BR /&gt;
[pre]&lt;BR /&gt;
%macro common_stuff (something);&lt;BR /&gt;
&lt;BR /&gt;
  title1 "this is the standard top title for &amp;amp;something" ;&lt;BR /&gt;
  title2 "this is the standard subtitle" ;&lt;BR /&gt;
&lt;BR /&gt;
  footnote j=l "Copyright (c) 2008 your company"&lt;BR /&gt;
              j=r "confidential treatment requested"&lt;BR /&gt;
              ;&lt;BR /&gt;
%mend;&lt;BR /&gt;
 &lt;BR /&gt;
....&lt;BR /&gt;
 &lt;BR /&gt;
%macro(Nothing);&lt;BR /&gt;
proc print uniform data=whatever;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 17 Apr 2008 16:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-macro-code/m-p/11625#M1110</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-04-17T16:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: writing macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-macro-code/m-p/11626#M1111</link>
      <description>Thanks for quick response.&lt;BR /&gt;
&lt;BR /&gt;
I guess the macro which you wrote is suitable for particular table but i am looking for a universal /general macro code which is  applicable  to any table ( pdf  report).&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks again.&lt;BR /&gt;
&lt;BR /&gt;
SAS Community member.</description>
      <pubDate>Thu, 17 Apr 2008 16:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-macro-code/m-p/11626#M1111</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-04-17T16:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: writing macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/writing-macro-code/m-p/11627#M1112</link>
      <description>I showed you an example.&lt;BR /&gt;
&lt;BR /&gt;
From there, you should be able to see, or figure out, what you want to do yourself.&lt;BR /&gt;
&lt;BR /&gt;
The universal thing to do is not use a macro and just use the title and footnote statements directly themselves.  Otherwise, you will just create an overly complicated wrapper that doesn't simplify anything.&lt;BR /&gt;
&lt;BR /&gt;
Like I just wrote in another thread.&lt;BR /&gt;
&lt;BR /&gt;
KISS -- keep it simple ...&lt;BR /&gt;
&lt;BR /&gt;
macro's are meant to simplify and condense/modularize reusable code.&lt;BR /&gt;
&lt;BR /&gt;
Like %getID and %getPassword(%getID)&lt;BR /&gt;
&lt;BR /&gt;
Where %getID is&lt;BR /&gt;
&lt;BR /&gt;
%macro getID;&lt;BR /&gt;
  %lowcase(%sysget(USERNAME))&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
and %getPassword retrieves a user's password from a secure table, which consumes a number of lines of code.&lt;BR /&gt;
&lt;BR /&gt;
Another way I use a macro is for database access.&lt;BR /&gt;
&lt;BR /&gt;
I have a macro that has all the pieces to access our MOM data warehouse.  I use it in two ways:&lt;BR /&gt;
1)  in an include file that has the following line&lt;BR /&gt;
[pre]&lt;BR /&gt;
  libname MOM oledb %MOMdb ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
2) to facilitate pass-through SQL&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  connect to oledb as momdb (%momdb) ;&lt;BR /&gt;
 &lt;BR /&gt;
  ...&lt;BR /&gt;
 &lt;BR /&gt;
  disconnect from momdb;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
%momdb returns all of the datasource=, provider=, user=, password=, schema= and prompt=no bits and pieces, providing a single point of maintenance should something have to change.&lt;BR /&gt;
&lt;BR /&gt;
Now it would be useless for me to write a generic universal %momdb statement for you to use because the bits and pieces would be different.  Same goes for a common title and footer thingy.</description>
      <pubDate>Thu, 17 Apr 2008 18:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/writing-macro-code/m-p/11627#M1112</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-04-17T18:13:12Z</dc:date>
    </item>
  </channel>
</rss>

