<?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 Macro variable was not created in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-was-not-created/m-p/830225#M328045</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;In this code I get warning and&amp;nbsp; macro variable FromDate was not created.&lt;/P&gt;
&lt;P&gt;May anyone help to solve the problem?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ttt;
format date date9.;
input date : date9.;
cards;
12JAN2022
17SEP2020
13MAR2020
;
run;


%MACRO  Start_Date;
%if %sysfunc(exist(ttt)) %then %do;
proc sql noprint;
select max(date)+1 as FromDate into : FromDate
from ttt
;
quit;
%end;
%else %Do;
Data _null_;
call symput('FromDate','01SEP2020'd);
Run;
%end;
%Mend Start_Date;
%Start_Date;
%put &amp;amp;FromDate;
/*WARNING: Apparent symbolic reference FROMDATE not resolved.*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 25 Aug 2022 06:00:20 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2022-08-25T06:00:20Z</dc:date>
    <item>
      <title>Macro variable was not created</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-was-not-created/m-p/830225#M328045</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;In this code I get warning and&amp;nbsp; macro variable FromDate was not created.&lt;/P&gt;
&lt;P&gt;May anyone help to solve the problem?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ttt;
format date date9.;
input date : date9.;
cards;
12JAN2022
17SEP2020
13MAR2020
;
run;


%MACRO  Start_Date;
%if %sysfunc(exist(ttt)) %then %do;
proc sql noprint;
select max(date)+1 as FromDate into : FromDate
from ttt
;
quit;
%end;
%else %Do;
Data _null_;
call symput('FromDate','01SEP2020'd);
Run;
%end;
%Mend Start_Date;
%Start_Date;
%put &amp;amp;FromDate;
/*WARNING: Apparent symbolic reference FROMDATE not resolved.*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Aug 2022 06:00:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-was-not-created/m-p/830225#M328045</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-08-25T06:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable was not created</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-was-not-created/m-p/830227#M328047</link>
      <description>&lt;P&gt;Your macro variable is local to the macro, so you won't see it outside. And in case the dataset exists but is empty, it will also not be created.&lt;/P&gt;
&lt;P&gt;Use your %IF in open code, without a macro definition:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let fromdate = '01sep2020'd;
%if %sysfunc(exist(ttt)) %then %do;
proc sql noprint;
select max(date)+1  into : FromDate
from ttt
;
quit;
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This takes care of both issues.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 06:08:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-was-not-created/m-p/830227#M328047</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-25T06:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable was not created</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-was-not-created/m-p/830239#M328051</link>
      <description>&lt;P&gt;submit %global before submit macro or first in macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%global fromdate;
%Start_Date;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO  Start_Date;
%global fromdate;
%if %sysfunc(exist(ttt)) %then %do;
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 07:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-was-not-created/m-p/830239#M328051</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-08-25T07:48:53Z</dc:date>
    </item>
  </channel>
</rss>

