<?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: Create a macro varaible with condional on exisiting of a data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754850#M238137</link>
    <description>May you please  show the full code in order to see where should i delete the semi colone as you mentioned before?&lt;BR /&gt;Thank you so much</description>
    <pubDate>Sun, 18 Jul 2021 14:03:45 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2021-07-18T14:03:45Z</dc:date>
    <item>
      <title>Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754834#M238121</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to do the following :&lt;/P&gt;
&lt;P&gt;There is a data set with purchase transactions called trans_tbl with following columns:ID,Date,amount.&lt;/P&gt;
&lt;P&gt;Please note that date column is type of&amp;nbsp; sas date value.&lt;/P&gt;
&lt;P&gt;I want to create a macro varaible called Mon that :&lt;/P&gt;
&lt;P&gt;1- If data set&amp;nbsp;trans_tbl doesn't exist then It will get value 2009&lt;/P&gt;
&lt;P&gt;2- If data set&amp;nbsp;trans_tbl&amp;nbsp; exist then It will get value of&amp;nbsp; put(Min(date),YYMMn4.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the way to do it please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data trans_tbl ;
Format date date9.;
Input Id date : date9. amount;
cards;
1 18FEB2021 100
2 21FEB2021 200
3 08FEB2021 300
4 11FEB2021 100
5 27FEB2021 400
6 02FEB2021 800
7 20FEB2021 900
8 29FEB2021 100
9 17FEB2021 200
10 15FEB2021 300
;
Run;

/**
If trans_tbl  exists then  %let Mon=2009;
else then 
proc sql noprint;
   select  put(min(date),yymmn4.)
      into :Mon
      from trans_tbl;
 quit;
%put &amp;amp;Mon.
**/
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 12:31:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754834#M238121</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-18T12:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754835#M238122</link>
      <description>&lt;P&gt;You can use the method in your earlier thread to determine what exists and what doesn't exist:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/IMPORT-IF-EXISTS-AND-CREATE-EMPTY-DATASET-IF-NOT/m-p/745824#M233877" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/IMPORT-IF-EXISTS-AND-CREATE-EMPTY-DATASET-IF-NOT/m-p/745824#M233877&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the EXIST() function for SAS data sets instead of the FILEEXIST function which works for operating system files.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 12:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754835#M238122</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-18T12:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754836#M238123</link>
      <description>&lt;LI-CODE lang="sas"&gt;data Null ;
if EXIST(trans_tbl ) then do;
proc sql noprint;
   select  put(min(date),yymmn4.)
      into :Mon
      from trans_tbl;
quit;
End;
Else do;
%let Mon=2009;
End;
Run;&lt;/LI-CODE&gt;
&lt;P&gt;Thanks,Will it work well?If not,may you correct the code and explain&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 12:49:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754836#M238123</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-18T12:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754837#M238124</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if EXIST(trans_tbl ) then do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This has to be done with macro statements&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(exist(trans_tbl)) %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and of course the rest of the code has to be adjusted as well (you need %END; and %ELSE %DO and so on)&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 12:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754837#M238124</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-18T12:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754838#M238125</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Should I put all in a macro or is it fine to wrote it in Data set null?&lt;/P&gt;
&lt;P&gt;Do you think this code will work well?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data trans_tbl ;
Format date date9.;
Input Id date : date9. amount;
cards;
1 18FEB2021 100
2 21FEB2021 200
3 08FEB2021 300
4 11FEB2021 100
5 27FEB2021 400
6 02FEB2021 800
7 20FEB2021 900
8 29FEB2021 100
9 17FEB2021 200
10 15FEB2021 300
;
Run;


data Null ;
%if %sysfunc(exist(trans_tbl)) %then %do;
proc sql noprint;
   select  put(min(date),yymmn4.)
      into :Mon
      from trans_tbl;
quit;
%End;
%Else do;
%let Mon=2009;
%End;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Jul 2021 13:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754838#M238125</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-18T13:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754839#M238126</link>
      <description>Did you try running the code to see whether it worked?&lt;BR /&gt;Cynthia</description>
      <pubDate>Sun, 18 Jul 2021 13:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754839#M238126</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-07-18T13:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754840#M238127</link>
      <description>&lt;P&gt;No yet because I&amp;nbsp; have no SAS in my home PC but the most important is to understand the cocept and the correct code&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 13:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754840#M238127</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-18T13:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754841#M238128</link>
      <description>&lt;P&gt;You can't put a PROC SQL inside a DATA NULL. You can put a PROC SQL inside a MACRO or inside a macro %IF/%THEN/%ELSE.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It's not even clear why you would want a DATA NULL here. (And technically, it's DATA _NULL_, if you leave off the underscores it has a different meaning). As shown in your earlier thread, no DATA NULL or DATA _NULL_ is used.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 13:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754841#M238128</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-18T13:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754842#M238129</link>
      <description>&lt;P&gt;Thanks a lot!&lt;/P&gt;
&lt;P&gt;So as I understand this is the correct code .&lt;/P&gt;
&lt;P&gt;Is there anything else to correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data trans_tbl ;
Format date date9.;
Input Id date : date9. amount;
cards;
1 18FEB2021 100
2 21FEB2021 200
3 08FEB2021 300
4 11FEB2021 100
5 27FEB2021 400
6 02FEB2021 800
7 20FEB2021 900
8 29FEB2021 100
9 17FEB2021 200
10 15FEB2021 300
;
Run;

%macro exist;
data Null ;
%if %sysfunc(exist(trans_tbl)) %then %do;
proc sql noprint;
   select  put(min(date),yymmn4.)
      into :Mon
      from trans_tbl;
quit;
%End;
%Else do;
%let Mon=2009;
%End;
Run;
%mend;
%exist;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Jul 2021 13:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754842#M238129</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-18T13:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754843#M238130</link>
      <description>&lt;P&gt;Should I delete Data NULL statement?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 13:10:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754843#M238130</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-18T13:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754844#M238131</link>
      <description>&lt;P&gt;data null not needed (and the associated RUN;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No semicolon needed after %EXIST&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 13:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754844#M238131</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-18T13:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754845#M238132</link>
      <description>&lt;P&gt;Why data null is not needed?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can it run with data null or it is an error to add data null statement?&lt;/P&gt;
&lt;P&gt;Why should I delete semicolon after "&lt;CODE class=" language-sas"&gt;%if %sysfunc(exist(trans_tbl)) %then %do "&amp;nbsp;?&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data trans_tbl ;
Format date date9.;
Input Id date : date9. amount;
cards;
1 18FEB2021 100
2 21FEB2021 200
3 08FEB2021 300
4 11FEB2021 100
5 27FEB2021 400
6 02FEB2021 800
7 20FEB2021 900
8 29FEB2021 100
9 17FEB2021 200
10 15FEB2021 300
;
Run;

%macro exist;
%if %sysfunc(exist(trans_tbl)) %then %do 
/**I removed semicolon here**/
proc sql noprint;
   select  put(min(date),yymmn4.)
      into :Mon
      from trans_tbl;
quit;
%End;
%Else %do;
%let Mon=2009;
%End;
%mend;
%exist;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Jul 2021 04:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754845#M238132</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-19T04:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754846#M238133</link>
      <description>&lt;P&gt;If you are using a reasonably recent release of SAS you don't need do define the macro.&amp;nbsp; Simple %IF/%THEN/%DO/%END/%ELSE/%DO blocks like that will work in open code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(exist(trans_tbl)) %then %do;
proc sql noprint;
   select  put(min(date),yymmn4.)
      into :Mon
      from trans_tbl;
quit;
%end;
%else do;
  %let Mon=2009;
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Jul 2021 13:21:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754846#M238133</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-18T13:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754848#M238135</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Why data null is not needed?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can it run with data null or it is an error to add data null statement?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Let me ask you the question: why do you think DATA NULL is needed? What data step functionality is being used here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Why should I delete semicolon after "&lt;CODE class=" language-sas"&gt;%if %sysfunc(exist(trans_tbl)) %then %do "&amp;nbsp;?&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please read carefully. No such statement was made.&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 13:56:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754848#M238135</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-18T13:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754850#M238137</link>
      <description>May you please  show the full code in order to see where should i delete the semi colone as you mentioned before?&lt;BR /&gt;Thank you so much</description>
      <pubDate>Sun, 18 Jul 2021 14:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754850#M238137</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-18T14:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754851#M238138</link>
      <description>&lt;P&gt;This is what I said:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No semicolon needed after %EXIST&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;where is %EXIST in your code?&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 14:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754851#M238138</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-18T14:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754853#M238140</link>
      <description>Should i use %exist or exist??&lt;BR /&gt;Can you explain please .&lt;BR /&gt;&lt;BR /&gt;May you show the full code of your solution?&lt;BR /&gt;</description>
      <pubDate>Sun, 18 Jul 2021 14:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754853#M238140</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-18T14:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754854#M238141</link>
      <description>&lt;P&gt;EXIST is a function provided by SAS, that you determines if a data set exists. You need to use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%EXIST is a macro that you wrote, and does other things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The proper call to the macro, in the last line of your program is:&lt;/P&gt;
&lt;P&gt;%EXIST&lt;/P&gt;
&lt;P&gt;and not&lt;/P&gt;
&lt;P&gt;%EXIST;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 14:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754854#M238141</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-18T14:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754856#M238143</link>
      <description>&lt;P&gt;SAS uses semi-colon to mark the end of a statement (both regular SAS statements and macro processor statements).&amp;nbsp; So in some cases having an extra semi-colon can change the meaning of the code by terminating a statement too early.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But note that this is not really an important distinction in this case.&amp;nbsp; &amp;nbsp;If the dataset exists then having the extra semi-colon after the macro call means that instead of running this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select  put(min(date),yymmn4.)
      into :Mon
      from trans_tbl;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will have run this code instead:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select  put(min(date),yymmn4.)
      into :Mon
      from trans_tbl;
quit;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS will see that extra semi-colon as an empty statement and so not do anything different that it would without it.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 15:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754856#M238143</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-18T15:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro varaible with condional on exisiting of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754857#M238144</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;/P&gt;
&lt;P&gt;True, but it can be an important distinction in other cases, and in my opinion, putting a semicolon after the call to a macro is a bad habit to get into.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jul 2021 15:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-varaible-with-condional-on-exisiting-of-a-data/m-p/754857#M238144</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-18T15:13:27Z</dc:date>
    </item>
  </channel>
</rss>

