<?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: conditional macro variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551552#M9012</link>
    <description>&lt;P&gt;Just edited the code and the macro didn't resolve&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;263&lt;/P&gt;&lt;P&gt;264 OPTIONS SYMBOLGEN mprint;&lt;/P&gt;&lt;P&gt;265 *OPTIONS MPRINT;&lt;/P&gt;&lt;P&gt;266&lt;/P&gt;&lt;P&gt;267 %let Year=2018;&lt;/P&gt;&lt;P&gt;268 %let Qtr=1;&lt;/P&gt;&lt;P&gt;269&lt;/P&gt;&lt;P&gt;270&lt;/P&gt;&lt;P&gt;271 %macro q1;&lt;/P&gt;&lt;P&gt;272 %let lastqyear=%eval(&amp;amp;year-1);&lt;/P&gt;&lt;P&gt;273 %let lastq=4;&lt;/P&gt;&lt;P&gt;274 %mend;&lt;/P&gt;&lt;P&gt;275&lt;/P&gt;&lt;P&gt;276 %macro otherq;&lt;/P&gt;&lt;P&gt;277 %let lastqyear=&amp;amp;year;&lt;/P&gt;&lt;P&gt;278 %let lastq=%eval(&amp;amp;qtr-1);&lt;/P&gt;&lt;P&gt;279&lt;/P&gt;&lt;P&gt;280 %mend;&lt;/P&gt;&lt;P&gt;281&lt;/P&gt;&lt;P&gt;282 %global lastQyear lastq;&lt;/P&gt;&lt;P&gt;283&lt;/P&gt;&lt;P&gt;284 %macro thisq;&lt;/P&gt;&lt;P&gt;285 %if &amp;amp;qtr=1 %then %do; %Q1; %end; %else %do; %otherq; %end;&lt;/P&gt;&lt;P&gt;286&lt;/P&gt;&lt;P&gt;287 %mend;&lt;/P&gt;&lt;P&gt;288&lt;/P&gt;&lt;P&gt;289&lt;/P&gt;&lt;P&gt;290&lt;/P&gt;&lt;P&gt;291&lt;/P&gt;&lt;P&gt;292 %let outpath=Z:\Reporting\Safety Reporting\2018\QC\AE_2018Mar30;&lt;/P&gt;&lt;P&gt;293&lt;/P&gt;&lt;P&gt;294 %let Hardlock=Z:\Reporting\Safety Reporting\&amp;amp;Year\Extract Data\SDTM\q&amp;amp;qtr;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable YEAR resolves to 2018&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable QTR resolves to 1&lt;/P&gt;&lt;P&gt;295 %let Phlext=Z:\Reporting\Safety Reporting\&amp;amp;lastqyear\Extract Data\SDTM\q&amp;amp;lastq;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable LASTQYEAR resolves to&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable LASTQ resolves to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Apr 2019 20:30:19 GMT</pubDate>
    <dc:creator>mona4u</dc:creator>
    <dc:date>2019-04-16T20:30:19Z</dc:date>
    <item>
      <title>conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551510#M8993</link>
      <description>&lt;P&gt;Hi all;&lt;/P&gt;&lt;P&gt;I am writing this conditional macro variable and I think I'm missing something. Also, &amp;nbsp;I wasn't able to see how it resolve by %put statement &amp;nbsp;and compile note option&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;OPTIONS&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SYMBOLGEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;mprint&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*OPTIONS MPRINT;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Year=2018;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Qtr=1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;&lt;I&gt;q1&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; lastqyear=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%eval&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(&amp;amp;year-1); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; lastq=4; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;&lt;I&gt;otherq&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; lastqyear=&amp;amp;year;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; lastq=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%eval&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(&amp;amp;qtr-1); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%global&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; lastQyear lastq;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;&lt;I&gt;thisq&lt;/I&gt;&lt;/STRONG&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;qtr=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; %&lt;STRONG&gt;&lt;I&gt;Q1&lt;/I&gt;&lt;/STRONG&gt;; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%else&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; %&lt;STRONG&gt;&lt;I&gt;otherq&lt;/I&gt;&lt;/STRONG&gt;; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; outpath=Z:\Reporting\Safety Reporting\2018\QC\AE_2018Mar30;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Hardlock=Z:\Reporting\Safety Reporting\&amp;amp;Year\Extract Data\SDTM\q&amp;amp;qtr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Phlext=Z:\Reporting\Safety Reporting\&amp;amp;lastqyear\Extract Data\SDTM\q&amp;amp;lastq;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 20:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551510#M8993</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2019-04-16T20:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551513#M8994</link>
      <description>&lt;P&gt;Your macro variables lastyear and lastq do not exist after the macros Q1 and OtherQ finish executing because the variables would be treated as local.&lt;/P&gt;
&lt;P&gt;You would need to add&lt;/P&gt;
&lt;P&gt;%global lastyear lastq;&lt;/P&gt;
&lt;P&gt;to each of those macros before assigning the values to the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look up Macro Variable Scope&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:10:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551513#M8994</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-16T19:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551515#M8996</link>
      <description>&lt;P&gt;You're missing two things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%LET statements need to end with a semicolon.&amp;nbsp; You have a bunch of them missing.&amp;nbsp; Perhaps they are missing only in what you posted, and not in what you actually ran.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second item is that the newly created macro variables (LASTQYEAR and LASTQ) are %local to the macro that defines them.&amp;nbsp; You need to add this statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%global lastqyear lastq;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The easiest place to add it is at the beginning of the %RESOLVE macro.&amp;nbsp; That way, you only need to add it once.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:12:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551515#M8996</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-16T19:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551524#M9002</link>
      <description>&lt;P&gt;it is still not working even after I put the semicolon&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:29:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551524#M9002</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2019-04-16T19:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551532#M9005</link>
      <description>&lt;P&gt;this is the error msg after I tried global statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;131&lt;/P&gt;&lt;P&gt;132 OPTIONS SYMBOLGEN mprint;&lt;/P&gt;&lt;P&gt;133 *OPTIONS MPRINT;&lt;/P&gt;&lt;P&gt;134&lt;/P&gt;&lt;P&gt;135 %let Year=2018;&lt;/P&gt;&lt;P&gt;136 %let Qtr=1;&lt;/P&gt;&lt;P&gt;137&lt;/P&gt;&lt;P&gt;138&lt;/P&gt;&lt;P&gt;139 %macro q1;&lt;/P&gt;&lt;P&gt;140 %let lastqyear=%eval(&amp;amp;year-1);&lt;/P&gt;&lt;P&gt;141 %let lastq=4;&lt;/P&gt;&lt;P&gt;142 %mend;&lt;/P&gt;&lt;P&gt;143&lt;/P&gt;&lt;P&gt;144 %macro otherq;&lt;/P&gt;&lt;P&gt;145 %let lastqyear=&amp;amp;year;&lt;/P&gt;&lt;P&gt;146 %let lastq=%eval(&amp;amp;qtr-1);&lt;/P&gt;&lt;P&gt;147&lt;/P&gt;&lt;P&gt;148 %mend;&lt;/P&gt;&lt;P&gt;149&lt;/P&gt;&lt;P&gt;150 %global lastyear lastq;&lt;/P&gt;&lt;P&gt;151&lt;/P&gt;&lt;P&gt;152 %macro resolve;&lt;/P&gt;&lt;P&gt;ERROR: Macro RESOLVE has been given a reserved name.&lt;/P&gt;&lt;P&gt;ERROR: A dummy macro will be compiled.&lt;/P&gt;&lt;P&gt;153 %if &amp;amp;qtr=1 %then %do; %Q1; %end; %else %do; %otherq; %end;&lt;/P&gt;&lt;P&gt;154&lt;/P&gt;&lt;P&gt;155 %mend;&lt;/P&gt;&lt;P&gt;156&lt;/P&gt;&lt;P&gt;157&lt;/P&gt;&lt;P&gt;158&lt;/P&gt;&lt;P&gt;159&lt;/P&gt;&lt;P&gt;160 %let outpath=Z:\Reporting\Safety Reporting\2018\QC\AE_2018Mar30;&lt;/P&gt;&lt;P&gt;161&lt;/P&gt;&lt;P&gt;162 %let Hardlock=Z:\Reporting\Safety Reporting\&amp;amp;Year\Extract Data\SDTM\q&amp;amp;qtr;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable YEAR resolves to 2018&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable QTR resolves to 1&lt;/P&gt;&lt;P&gt;163 %let Phlext=Z:\Reporting\Safety Reporting\&amp;amp;lastqyear\Extract Data\SDTM\q&amp;amp;lastq;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;WARNING: Apparent symbolic reference LASTQYEAR not resolved.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;SYMBOLGEN: Macro variable LASTQ resolves to&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551532#M9005</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2019-04-16T19:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551537#M9006</link>
      <description>&lt;P&gt;This error means you have to change the name of the macro.&amp;nbsp; RESOLVE is not a legal name.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551537#M9006</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-16T19:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551540#M9008</link>
      <description>&lt;P&gt;now this is the error msg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;197&lt;/P&gt;&lt;P&gt;198 OPTIONS SYMBOLGEN mprint;&lt;/P&gt;&lt;P&gt;199 *OPTIONS MPRINT;&lt;/P&gt;&lt;P&gt;200&lt;/P&gt;&lt;P&gt;201 %let Year=2018;&lt;/P&gt;&lt;P&gt;202 %let Qtr=1;&lt;/P&gt;&lt;P&gt;203&lt;/P&gt;&lt;P&gt;204&lt;/P&gt;&lt;P&gt;205 %macro q1;&lt;/P&gt;&lt;P&gt;206 %let lastqyear=%eval(&amp;amp;year-1);&lt;/P&gt;&lt;P&gt;207 %let lastq=4;&lt;/P&gt;&lt;P&gt;208 %mend;&lt;/P&gt;&lt;P&gt;209&lt;/P&gt;&lt;P&gt;210 %macro otherq;&lt;/P&gt;&lt;P&gt;211 %let lastqyear=&amp;amp;year;&lt;/P&gt;&lt;P&gt;212 %let lastq=%eval(&amp;amp;qtr-1);&lt;/P&gt;&lt;P&gt;213&lt;/P&gt;&lt;P&gt;214 %mend;&lt;/P&gt;&lt;P&gt;215&lt;/P&gt;&lt;P&gt;216 %global lastyear lastq;&lt;/P&gt;&lt;P&gt;217&lt;/P&gt;&lt;P&gt;218 %macro thisq;&lt;/P&gt;&lt;P&gt;219 %if &amp;amp;qtr=1 %then %do; %Q1; %end; %else %do; %otherq; %end;&lt;/P&gt;&lt;P&gt;220&lt;/P&gt;&lt;P&gt;221 %mend;&lt;/P&gt;&lt;P&gt;222&lt;/P&gt;&lt;P&gt;223&lt;/P&gt;&lt;P&gt;224&lt;/P&gt;&lt;P&gt;225&lt;/P&gt;&lt;P&gt;226 %let outpath=Z:\Reporting\Safety Reporting\2018\QC\AE_2018Mar30;&lt;/P&gt;&lt;P&gt;227&lt;/P&gt;&lt;P&gt;228 %let Hardlock=Z:\Reporting\Safety Reporting\&amp;amp;Year\Extract Data\SDTM\q&amp;amp;qtr;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable YEAR resolves to 2018&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable QTR resolves to 1&lt;/P&gt;&lt;P&gt;229 %let Phlext=Z:\Reporting\Safety Reporting\&amp;amp;lastqyear\Extract Data\SDTM\q&amp;amp;lastq;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference LASTQYEAR not resolved.&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable LASTQ resolves to&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551540#M9008</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2019-04-16T19:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551547#M9009</link>
      <description>&lt;OL&gt;
&lt;LI&gt;macro thisq is never called&lt;/LI&gt;
&lt;LI&gt;lastqyear is not defined global, so it stays local to q1 and otherq&lt;/LI&gt;
&lt;LI&gt;all those calculations are much better done in a data step with date functions, the macros are not necessary at all&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 16 Apr 2019 20:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551547#M9009</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-16T20:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551549#M9010</link>
      <description>&lt;P&gt;Your %GLOBAL statement defined&amp;nbsp;&lt;SPAN&gt;lastyear&amp;nbsp;but your code referenced&amp;nbsp;lastQyear&amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;You defined three macros, but you did not call any of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 20:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551549#M9010</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-16T20:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551551#M9011</link>
      <description>A missing letter:  the %global statement should mention LASTQYEAR, not LASTYEAR.</description>
      <pubDate>Tue, 16 Apr 2019 20:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551551#M9011</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-16T20:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551552#M9012</link>
      <description>&lt;P&gt;Just edited the code and the macro didn't resolve&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;263&lt;/P&gt;&lt;P&gt;264 OPTIONS SYMBOLGEN mprint;&lt;/P&gt;&lt;P&gt;265 *OPTIONS MPRINT;&lt;/P&gt;&lt;P&gt;266&lt;/P&gt;&lt;P&gt;267 %let Year=2018;&lt;/P&gt;&lt;P&gt;268 %let Qtr=1;&lt;/P&gt;&lt;P&gt;269&lt;/P&gt;&lt;P&gt;270&lt;/P&gt;&lt;P&gt;271 %macro q1;&lt;/P&gt;&lt;P&gt;272 %let lastqyear=%eval(&amp;amp;year-1);&lt;/P&gt;&lt;P&gt;273 %let lastq=4;&lt;/P&gt;&lt;P&gt;274 %mend;&lt;/P&gt;&lt;P&gt;275&lt;/P&gt;&lt;P&gt;276 %macro otherq;&lt;/P&gt;&lt;P&gt;277 %let lastqyear=&amp;amp;year;&lt;/P&gt;&lt;P&gt;278 %let lastq=%eval(&amp;amp;qtr-1);&lt;/P&gt;&lt;P&gt;279&lt;/P&gt;&lt;P&gt;280 %mend;&lt;/P&gt;&lt;P&gt;281&lt;/P&gt;&lt;P&gt;282 %global lastQyear lastq;&lt;/P&gt;&lt;P&gt;283&lt;/P&gt;&lt;P&gt;284 %macro thisq;&lt;/P&gt;&lt;P&gt;285 %if &amp;amp;qtr=1 %then %do; %Q1; %end; %else %do; %otherq; %end;&lt;/P&gt;&lt;P&gt;286&lt;/P&gt;&lt;P&gt;287 %mend;&lt;/P&gt;&lt;P&gt;288&lt;/P&gt;&lt;P&gt;289&lt;/P&gt;&lt;P&gt;290&lt;/P&gt;&lt;P&gt;291&lt;/P&gt;&lt;P&gt;292 %let outpath=Z:\Reporting\Safety Reporting\2018\QC\AE_2018Mar30;&lt;/P&gt;&lt;P&gt;293&lt;/P&gt;&lt;P&gt;294 %let Hardlock=Z:\Reporting\Safety Reporting\&amp;amp;Year\Extract Data\SDTM\q&amp;amp;qtr;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable YEAR resolves to 2018&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable QTR resolves to 1&lt;/P&gt;&lt;P&gt;295 %let Phlext=Z:\Reporting\Safety Reporting\&amp;amp;lastqyear\Extract Data\SDTM\q&amp;amp;lastq;&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable LASTQYEAR resolves to&lt;/P&gt;&lt;P&gt;SYMBOLGEN: Macro variable LASTQ resolves to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 20:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551552#M9012</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2019-04-16T20:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551553#M9013</link>
      <description>&lt;P&gt;Why are you making things so complicated?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Year=2018;
%let Qtr=1;

data _null_;
   previous=intnx('qtr',yyq(&amp;amp;year,&amp;amp;qtr),-1);
   call symputx('lastqyear',year(previous),'g');
   call symputx('lastq',qtr(previous),'g');
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;1577  %put &amp;amp;=year &amp;amp;=qtr;
YEAR=2018 QTR=1
1578  %put &amp;amp;=lastqyear &amp;amp;=lastq;
LASTQYEAR=2017 LASTQ=4&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Apr 2019 20:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551553#M9013</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-16T20:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551555#M9014</link>
      <description>&lt;P&gt;Looks like it did what you asked.&lt;/P&gt;
&lt;P&gt;You probably want to run one of those macros you defined.&lt;/P&gt;
&lt;P&gt;Try adding this line before the last to %LET statements:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%thisq&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 20:38:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551555#M9014</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-16T20:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551558#M9015</link>
      <description>&lt;P&gt;this code is good put I still have limitations since I need the code to look to the same year if it the q2,q3,q4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 20:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551558#M9015</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2019-04-16T20:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: conditional macro variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551561#M9016</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134228"&gt;@mona4u&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;this code is good put I still have limitations since I need the code to look to the same year if it the q2,q3,q4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Have you even&amp;nbsp;&lt;EM&gt;tried&lt;/EM&gt; it before posting this?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 21:02:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/conditional-macro-variable/m-p/551561#M9016</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-16T21:02:04Z</dc:date>
    </item>
  </channel>
</rss>

