<?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: if then else in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837729#M36177</link>
    <description>&lt;P&gt;It doesnt seem to be working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With above code you advised:&lt;BR /&gt;When work.CUSTOM1 is available, it doesnt send out email, and no further action.&lt;BR /&gt;When work.CUSTOM1 is NOT available, it doesnt process the data step.&lt;/P&gt;&lt;P&gt;I suspected I might missed something in the code. Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2022 19:48:39 GMT</pubDate>
    <dc:creator>miss2223</dc:creator>
    <dc:date>2022-10-10T19:48:39Z</dc:date>
    <item>
      <title>if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837593#M36167</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to do :&lt;/P&gt;&lt;P&gt;If work.CUSTOM1 is available/exist then send out an email to notify then STOP, with no further action. if data not available then&amp;nbsp;process the data step as per usual.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code below it allows to send an email when&amp;nbsp;CUSTOM1 is available, however the process step runs as well. I want it to stop processing when we know CUSTOM1 is there. Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;if exist("work.CUSTOM1") then&lt;BR /&gt;call execute(catt(&lt;BR /&gt;"filename send email "&lt;BR /&gt;," to=('test@abc.com')"&lt;BR /&gt;," type='text/html' "&lt;BR /&gt;," subject=""Data_FAILED"" "&lt;BR /&gt;,"from='test@abc.com' ;"&lt;BR /&gt;,"ods html body=send;"&lt;BR /&gt;,"ods html close;"&lt;BR /&gt;,"filename send clear;" ));&lt;BR /&gt;else;&lt;BR /&gt;data original_data;&lt;BR /&gt;input var1 $ CON_DATE_START :ddmmyy10. PL_DATE_START :ddmmyy10. SS_DATE_START :ddmmyy10.;&lt;BR /&gt;format CON_DATE_START ddmmyy10. PL_DATE_START ddmmyy10. SS_DATE_START ddmmyy10.;&lt;BR /&gt;datalines;&lt;BR /&gt;A 12/12/2008 11/01/2022 05/10/2007&lt;BR /&gt;B 19/01/2001 11/02/2008 01/03/2020&lt;BR /&gt;C 23/10/2008 02/08/2019 02/02/2010&lt;BR /&gt;D 01/09/2002 01/01/2000 19/03/2006&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 02:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837593#M36167</guid>
      <dc:creator>miss2223</dc:creator>
      <dc:date>2022-10-10T02:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837598#M36168</link>
      <description>&lt;P&gt;This is where using the macro language is better:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(exist(work.CUSTOM1))
%then %do;

filename send email 
  to=('test@abc.com')
  type='text/html'
  subject="Data_FAILED"
  from='test@abc.com'
;
ods html body=send;
ods html close;
filename send clear;

%end;
%else %do;

data original_data;
input var1 $ CON_DATE_START :ddmmyy10. PL_DATE_START :ddmmyy10. SS_DATE_START :ddmmyy10.;
format CON_DATE_START ddmmyy10. PL_DATE_START ddmmyy10. SS_DATE_START ddmmyy10.;
datalines;
A 12/12/2008 11/01/2022 05/10/2007
B 19/01/2001 11/02/2008 01/03/2020
C 23/10/2008 02/08/2019 02/02/2010
D 01/09/2002 01/01/2000 19/03/2006
;

%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Untested, posted from my tablet.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 05:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837598#M36168</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-10T05:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837729#M36177</link>
      <description>&lt;P&gt;It doesnt seem to be working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With above code you advised:&lt;BR /&gt;When work.CUSTOM1 is available, it doesnt send out email, and no further action.&lt;BR /&gt;When work.CUSTOM1 is NOT available, it doesnt process the data step.&lt;/P&gt;&lt;P&gt;I suspected I might missed something in the code. Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 19:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837729#M36177</guid>
      <dc:creator>miss2223</dc:creator>
      <dc:date>2022-10-10T19:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837740#M36180</link>
      <description>&lt;P&gt;"Isn't working" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the "&amp;lt;/&amp;gt;" to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "&amp;lt;/&amp;gt;" icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 22:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837740#M36180</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-10T22:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837782#M36187</link>
      <description>&lt;P&gt;Add diagnostics:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(exist(work.CUSTOM1))
%then %do;
%put Dataset found!;
filename send email 
  to=('test@abc.com')
  type='text/html'
  subject="Data_FAILED"
  from='test@abc.com'
;
ods html body=send;
ods html close;
filename send clear;

%end;
%else %do;
%put Dataset not found!;
data ;
input var1 $ CON_DATE_START :ddmmyy10. PL_DATE_START :ddmmyy10. SS_DATE_START :ddmmyy10.;
format CON_DATE_START ddmmyy10. PL_DATE_START ddmmyy10. SS_DATE_START ddmmyy10.;
datalines;
A 12/12/2008 11/01/2022 05/10/2007
B 19/01/2001 11/02/2008 01/03/2020
C 23/10/2008 02/08/2019 02/02/2010
D 01/09/2002 01/01/2000 19/03/2006
;

%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Run the code in both situations, and post the&amp;nbsp;&lt;U&gt;complete&lt;/U&gt; log, using this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 04:24:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/837782#M36187</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-11T04:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838320#M36220</link>
      <description>&lt;PRE&gt;1                                                                            The SAS System                                              15:04 Thursday, October 13, 2022

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROJECTPATH='';
5          %LET _CLIENTPROJECTNAME='';
6          %LET _SASPROGRAMFILE=;
7          
8          ODS _ALL_ CLOSE;
9          OPTIONS DEV=ACTIVEX;
10         GOPTIONS XPIXELS=0 YPIXELS=0;
11         FILENAME EGSR TEMP;
12         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
13             STYLE=HtmlBlue
14             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
15             NOGTITLE
16             NOGFOOTNOTE
17             GPATH=&amp;amp;sasworklocation
18             ENCODING=UTF8
19             options(rolap="on")
20         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
21         
22         GOPTIONS ACCESSIBLE;
23         %macro test;
24         %if %sysfunc(exist(work.CUSTOM1))
25         %then %do;
26         %put Dataset found!;
27         filename send email
28           to=('test@abc.com')
29           type='text/html'
30           subject="Data_FAILED"
31           from='test@abc.com'
32         ;
33         ods html body=send;
34         ods html close;
35         filename send clear;
36         %end;
37         %else %do;
38         %put Dataset not found!;
39         data ;
40         input var1 $ CON_DATE_START :ddmmyy10. PL_DATE_START :ddmmyy10. SS_DATE_START :ddmmyy10.;
41         format CON_DATE_START ddmmyy10. PL_DATE_START ddmmyy10. SS_DATE_START ddmmyy10.;
42         datalines;
43         A 12/12/2008 11/01/2022 05/10/2007
44         B 19/01/2001 11/02/2008 01/03/2020
45         C 23/10/2008 02/08/2019 02/02/2010
46         D 01/09/2002 01/01/2000 19/03/2006
2                                                                            The SAS System                                              15:04 Thursday, October 13, 2022

47         ;
48         %end;
49         %mend;
50         
51         GOPTIONS NOACCESSIBLE;
52         %LET _CLIENTTASKLABEL=;
53         %LET _CLIENTPROJECTPATH=;
54         %LET _CLIENTPROJECTNAME=;
55         %LET _SASPROGRAMFILE=;
56         
57         ;*';*";*/;quit;run;
58         ODS _ALL_ CLOSE;
59         
60         
61         QUIT; RUN;
62         &lt;/PRE&gt;&lt;P&gt;The code runs fine with no error, but no email send when 'work.CUSTOM1' is available&lt;/P&gt;&lt;P&gt;when 'work.CUSTOM1' is unavailable, the data step doesnt generate.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see above log. Thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 02:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838320#M36220</guid>
      <dc:creator>miss2223</dc:creator>
      <dc:date>2022-10-13T02:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838326#M36221</link>
      <description>&lt;P&gt;I haven't tried to send an email with SAS in decades.&lt;/P&gt;
&lt;P&gt;But it looks like you are trying to use the EMAIL fileref engine to trigger the sending of the email.&lt;/P&gt;
&lt;P&gt;But you never actually send any content to the fileref you created.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You pointed ODS output at that fileref, but then you closed it without ever sending anything to it.&lt;/P&gt;
&lt;P&gt;What was you it you planned to send as the CONTENT of the email?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 03:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838326#M36221</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-13T03:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838337#M36224</link>
      <description>&lt;P&gt;You define a macro, but you never call it, so nothing happens.&lt;/P&gt;
&lt;P&gt;Please note that my code has no macro definition, as %IF can be used in "open code" nowadays. Use my code as posted.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 05:27:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838337#M36224</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-13T05:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838537#M36243</link>
      <description>&lt;PRE&gt;1                                                                            The SAS System                                                09:08 Friday, October 14, 2022

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROJECTPATH='';
5          %LET _CLIENTPROJECTNAME='';
6          %LET _SASPROGRAMFILE=;
7          
8          ODS _ALL_ CLOSE;
9          OPTIONS DEV=ACTIVEX;
10         GOPTIONS XPIXELS=0 YPIXELS=0;
11         FILENAME EGSR TEMP;
12         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
13             STYLE=HtmlBlue
14             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
15             NOGTITLE
16             NOGFOOTNOTE
17             GPATH=&amp;amp;sasworklocation
18             ENCODING=UTF8
19             options(rolap="on")
20         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
21         
22         GOPTIONS ACCESSIBLE;
ERROR: The %IF statement is not valid in open code.
23         %if %sysfunc(exist(work.CUSTOM1))
24         %then %do;
25         %put Dataset found!;
Dataset found!
26         filename send email
27           to=('test@abc.com')
28           type='text/html'
29           subject="Data_FAILED"
30           from='test@abc.com'
31         ;
32         ods html body=send;
NOTE: Writing HTML Body file: SEND
33         ods html close;
Message sent
      To:          'test@abc.com'
      Cc:          
      Bcc:         
      Subject:     Data_FAILED
      Attachments: 
34         filename send clear;
NOTE: Fileref SEND has been deassigned.
ERROR: The %END statement is not valid in open code.
ERROR: The %ELSE statement is not valid in open code.
2                                                                            The SAS System                                                09:08 Friday, October 14, 2022

35         
36         %end;
37         %else %do;
38         %put Dataset not found!;
Dataset not found!
39         data ;
40         input var1 $ CON_DATE_START :ddmmyy10. PL_DATE_START :ddmmyy10. SS_DATE_START :ddmmyy10.;
41         format CON_DATE_START ddmmyy10. PL_DATE_START ddmmyy10. SS_DATE_START ddmmyy10.;
42         datalines;

NOTE: The data set WORK.DATA5 has 4 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              739.59k
      OS Memory           22108.00k
      Timestamp           14/10/2022 11:15:13 AM
      Step Count                        7  Switch Count  46
      
47         ;

48         
49         %end;
ERROR: The %END statement is not valid in open code.
50         
51         GOPTIONS NOACCESSIBLE;
52         %LET _CLIENTTASKLABEL=;
53         %LET _CLIENTPROJECTPATH=;
54         %LET _CLIENTPROJECTNAME=;
55         %LET _SASPROGRAMFILE=;
56         
57         ;*';*";*/;quit;run;
58         ODS _ALL_ CLOSE;
59         
60         
61         QUIT; RUN;
62         &lt;/PRE&gt;&lt;P&gt;Sorry for the confusion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Email generate and datastep run, when 'work.CUSTOM1' is available&lt;/P&gt;&lt;P&gt;Email generate and datastep run, also when 'work.CUSTOM1' is unavailable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought 'else' statement will only execute when data 'work.CUSTOM1' is unavailable?&lt;/P&gt;&lt;P&gt;Thanks for your time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 00:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838537#M36243</guid>
      <dc:creator>miss2223</dc:creator>
      <dc:date>2022-10-14T00:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838540#M36244</link>
      <description>&lt;P&gt;The log you show us only compiles the macro but doesn't execute it. If you would execute you'd get an error because you can't have a DATALINES statement within a macro.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1665708554298.png" style="width: 824px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76170i0B7A1602E18EA844/image-dimensions/824x208?v=v2" width="824" height="208" role="button" title="Patrick_0-1665708554298.png" alt="Patrick_0-1665708554298.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 00:49:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838540#M36244</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-10-14T00:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838576#M36247</link>
      <description>&lt;P&gt;While DATALINES cannot be used in a macro, it can be used in an "open code" %IF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(exist(work.CUSTOM1))
%then %do;
%put Dataset found!;
filename send email
  to=('test@abc.com')
  type='text/html'
  subject="Data_FAILED"
  from='test@abc.com'
;
ods html body=send;
ods text="something for the mail";
ods html close;
filename send clear;
%end;
%else %do;
%put Dataset not found!;
data dataset;
input var1 $ CON_DATE_START :ddmmyy10. PL_DATE_START :ddmmyy10. SS_DATE_START :ddmmyy10.;
format CON_DATE_START ddmmyy10. PL_DATE_START ddmmyy10. SS_DATE_START ddmmyy10.;
datalines;
A 12/12/2008 11/01/2022 05/10/2007
B 19/01/2001 11/02/2008 01/03/2020
C 23/10/2008 02/08/2019 02/02/2010
D 01/09/2002 01/01/2000 19/03/2006
;
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;No macro definition!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 06:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838576#M36247</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-14T06:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: if then else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838878#M36278</link>
      <description>&lt;P&gt;The code works!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it generates the email when the data does not exist.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;1                                                                            The SAS System                                                09:49 Monday, October 17, 2022

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROJECTPATH='';
5          %LET _CLIENTPROJECTNAME='';
6          %LET _SASPROGRAMFILE=;
7          
8          ODS _ALL_ CLOSE;
9          OPTIONS DEV=ACTIVEX;
10         GOPTIONS XPIXELS=0 YPIXELS=0;
11         FILENAME EGSR TEMP;
12         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
13             STYLE=HtmlBlue
14             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
15             NOGTITLE
16             NOGFOOTNOTE
17             GPATH=&amp;amp;sasworklocation
18             ENCODING=UTF8
19             options(rolap="on")
20         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
21         
22         GOPTIONS ACCESSIBLE;
ERROR: The %IF statement is not valid in open code.
23         %if %sysfunc(exist(work.CUSTOM1))
24         %then %do;
25         %put Dataset found!;
Dataset found!
26         filename send email
27           to=('test@abc.com')
28           type='text/html'
29           subject="Data_FAILED"
30           from='test@abc.com'
31         ;
32         ods html body=send;
NOTE: Writing HTML Body file: SEND
33         ods text="something for the mail";
34         ods html close;
Message sent
      To:          'test@abc.com'
      Cc:          
      Bcc:         
      Subject:     Data_FAILED
      Attachments: 
35         filename send clear;
NOTE: Fileref SEND has been deassigned.
ERROR: The %END statement is not valid in open code.
2                                                                            The SAS System                                                09:49 Monday, October 17, 2022

ERROR: The %ELSE statement is not valid in open code.
36         %end;
37         %else %do;
38         %put Dataset not found!;
Dataset not found!
39         data dataset;
40         input var1 $ CON_DATE_START :ddmmyy10. PL_DATE_START :ddmmyy10. SS_DATE_START :ddmmyy10.;
41         format CON_DATE_START ddmmyy10. PL_DATE_START ddmmyy10. SS_DATE_START ddmmyy10.;
42         datalines;

NOTE: The data set WORK.DATASET has 4 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      user cpu time       0.01 seconds
      system cpu time     0.00 seconds
      memory              739.53k
      OS Memory           21852.00k
      Timestamp           17/10/2022 10:47:45 AM
      Step Count                        6  Switch Count  46
      
47         ;

48         %end;
ERROR: The %END statement is not valid in open code.
49         
50         GOPTIONS NOACCESSIBLE;
51         %LET _CLIENTTASKLABEL=;
52         %LET _CLIENTPROJECTPATH=;
53         %LET _CLIENTPROJECTNAME=;
54         %LET _SASPROGRAMFILE=;
55         
56         ;*';*";*/;quit;run;
57         ODS _ALL_ CLOSE;
58         
59         
60         QUIT; RUN;
61         &lt;/PRE&gt;</description>
      <pubDate>Sun, 16 Oct 2022 21:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/if-then-else/m-p/838878#M36278</guid>
      <dc:creator>miss2223</dc:creator>
      <dc:date>2022-10-16T21:51:11Z</dc:date>
    </item>
  </channel>
</rss>

