<?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: Review of an error while  using 'if else' statement in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Review-of-an-error-while-using-if-else-statement/m-p/874166#M38802</link>
    <description>&lt;P&gt;&amp;nbsp;Hi, Quentin&lt;/P&gt;&lt;P&gt;As tried the query provided by you worked successfully, much more thanks for your help and support.&lt;/P&gt;</description>
    <pubDate>Fri, 05 May 2023 16:04:38 GMT</pubDate>
    <dc:creator>Brownisiak69</dc:creator>
    <dc:date>2023-05-05T16:04:38Z</dc:date>
    <item>
      <title>Review of an error while  using 'if else' statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Review-of-an-error-while-using-if-else-statement/m-p/874158#M38798</link>
      <description>&lt;P&gt;I need an extra variable as ' environment' with the result after 01/03/2020 as 'pandemic' else 'normal'. I wrote the below mention query.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA SSN2.ENVIRONMENT;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SET SSN2.TASK5;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;KEEP FULL_NAME CITY STATE PHONE DATE_OF_JOINING COURSE ENVIRONMENT TOOL FEE;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF DATE_OF_JOINING &amp;lt;= 01/03/2020 THEN ENVIRONMENT='NORMAL';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ELSE ENVIRONMENT= 'PANDAMIC';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But i got the error all the result pandemic. kindly recheck and suggest.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 15:10:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Review-of-an-error-while-using-if-else-statement/m-p/874158#M38798</guid>
      <dc:creator>Brownisiak69</dc:creator>
      <dc:date>2023-05-05T15:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Review of an error while  using 'if else' statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Review-of-an-error-while-using-if-else-statement/m-p/874161#M38799</link>
      <description>&lt;P&gt;To specify a date constant in SAS it must be in the date9 format, e.g DDMMMYY or '01Mar2020'd&lt;/P&gt;
&lt;P&gt;Is pandemic spelled correctly in the code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA SSN2.ENVIRONMENT;

SET SSN2.TASK5;

KEEP FULL_NAME CITY STATE PHONE DATE_OF_JOINING COURSE ENVIRONMENT TOOL FEE;

IF DATE_OF_JOINING &amp;lt;= '01Mar2020'd THEN ENVIRONMENT='NORMAL';
ELSE ENVIRONMENT= 'PANDEMIC';

RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/442497"&gt;@Brownisiak69&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I need an extra variable as ' environment' with the result after 01/03/2020 as 'pandemic' else 'normal'. I wrote the below mention query.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DATA SSN2.ENVIRONMENT;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SET SSN2.TASK5;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;KEEP FULL_NAME CITY STATE PHONE DATE_OF_JOINING COURSE ENVIRONMENT TOOL FEE;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IF DATE_OF_JOINING &amp;lt;= 01/03/2020 THEN ENVIRONMENT='NORMAL';&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ELSE ENVIRONMENT= 'PANDAMIC';&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;But i got the error all the result pandemic. kindly recheck and suggest.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 15:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Review-of-an-error-while-using-if-else-statement/m-p/874161#M38799</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-05-05T15:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Review of an error while  using 'if else' statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Review-of-an-error-while-using-if-else-statement/m-p/874162#M38800</link>
      <description>&lt;P&gt;If date_of_joining is a date variable, you would need to change to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF DATE_OF_JOINING &amp;lt;= "03Jan2020"d THEN ENVIRONMENT='NORMAL';
ELSE ENVIRONMENT= 'PANDAMIC';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;"03Jan2020"d is a date literal.&amp;nbsp; Your current code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF DATE_OF_JOINING &amp;lt;= 01/03/2020 THEN ENVIRONMENT='NORMAL';
ELSE ENVIRONMENT= 'PANDAMIC';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will run without error, but SAS will interpret 01/03/2020 as being division.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;1    data _null_ ;
2      x=01/03/2020 ;
3      y="03Jan2020"d ;
4      put x= y=;
5    run ;

x=0.0001650165 y=21917
&lt;/PRE&gt;
&lt;P&gt;Note if any records have missing values for Date_Of_Joining, this would categorize them as Normal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 15:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Review-of-an-error-while-using-if-else-statement/m-p/874162#M38800</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-05-05T15:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Review of an error while  using 'if else' statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Review-of-an-error-while-using-if-else-statement/m-p/874166#M38802</link>
      <description>&lt;P&gt;&amp;nbsp;Hi, Quentin&lt;/P&gt;&lt;P&gt;As tried the query provided by you worked successfully, much more thanks for your help and support.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 16:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Review-of-an-error-while-using-if-else-statement/m-p/874166#M38802</guid>
      <dc:creator>Brownisiak69</dc:creator>
      <dc:date>2023-05-05T16:04:38Z</dc:date>
    </item>
  </channel>
</rss>

