<?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: Are they the same thing? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Are-they-the-same-thing/m-p/807911#M318569</link>
    <description>&lt;P&gt;Macros and macro variables are different things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A macro is a block of SAS code that can be called as needed to execute.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inside macros (and also outside macros), macro variables are entities that have a value. One way to assign values to macro variables is via the %LET statement. You can change the value of a macro variable as needed, and you can have as many macro variables as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on the values of macro variables used by the macro, the code that is executed will change. In one run of the macro, it does one thing, in another run of the macro, it does a different thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A typical (but very simplified) example of a macro named EXTRACT which uses a macro variable called DATE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro extract;
     proc sql;
          create table abcd as select * from database.table where date&amp;gt;="&amp;amp;date"d;
     quit;
     title "Data Set ABCD starting at &amp;amp;date";
     proc print data=abcd;
     run;
%mend;

%let date=01MAR2021;
%extract&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can imagine, if you change the value of DATE, you get a different extract from the database.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Apr 2022 19:49:44 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-04-14T19:49:44Z</dc:date>
    <item>
      <title>Are they the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Are-they-the-same-thing/m-p/807908#M318568</link>
      <description>&lt;P&gt;This chapter gives you the tools to use macro variables&lt;BR /&gt;and write simple macros. Macros are particularly useful if you want to make your SAS&lt;BR /&gt;programs more flexible and allow them to be used in different situations without having&lt;BR /&gt;to rewrite entire programs.( from my textbook of SAS)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;macro variables and macros are the same things ?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 19:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Are-they-the-same-thing/m-p/807908#M318568</guid>
      <dc:creator>tianerhu</dc:creator>
      <dc:date>2022-04-14T19:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Are they the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Are-they-the-same-thing/m-p/807911#M318569</link>
      <description>&lt;P&gt;Macros and macro variables are different things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A macro is a block of SAS code that can be called as needed to execute.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inside macros (and also outside macros), macro variables are entities that have a value. One way to assign values to macro variables is via the %LET statement. You can change the value of a macro variable as needed, and you can have as many macro variables as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on the values of macro variables used by the macro, the code that is executed will change. In one run of the macro, it does one thing, in another run of the macro, it does a different thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A typical (but very simplified) example of a macro named EXTRACT which uses a macro variable called DATE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro extract;
     proc sql;
          create table abcd as select * from database.table where date&amp;gt;="&amp;amp;date"d;
     quit;
     title "Data Set ABCD starting at &amp;amp;date";
     proc print data=abcd;
     run;
%mend;

%let date=01MAR2021;
%extract&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can imagine, if you change the value of DATE, you get a different extract from the database.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 19:49:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Are-they-the-same-thing/m-p/807911#M318569</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-14T19:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Are they the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Are-they-the-same-thing/m-p/807912#M318570</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/268447"&gt;@tianerhu&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;macro variables and macros are the same things ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No. Start here:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1ccprwibo8gvqn1q6zinvjlzuut.htm" target="_blank" rel="noopener"&gt;Getting Started with the Macro Facility&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n1nks63d6g1rk2n1owajhi374c6w.htm" target="_blank" rel="noopener"&gt;Replacing Text Strings Using Macro Variables&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/de/pgmsascdc/9.4_3.5/mcrolref/n0pfmkjlc3e719n1lks4go8ke61r.htm" target="_blank" rel="noopener"&gt;Generating SAS Code Using Macros&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 19:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Are-they-the-same-thing/m-p/807912#M318570</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-14T19:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Are they the same thing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Are-they-the-same-thing/m-p/807913#M318571</link>
      <description>Thank you for your help.</description>
      <pubDate>Thu, 14 Apr 2022 19:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Are-they-the-same-thing/m-p/807913#M318571</guid>
      <dc:creator>tianerhu</dc:creator>
      <dc:date>2022-04-14T19:50:47Z</dc:date>
    </item>
  </channel>
</rss>

