<?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: Two conditional IF statements in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Two-conditional-IF-statements/m-p/156351#M41012</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ballardw,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My apologies, this was more or less a lack of knowledge of SAS on my part and not being able to find an example use 'and' in an if/then statement. Plus my statement were not working correctly, but now they are.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank all of you for your help! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Sep 2014 15:52:25 GMT</pubDate>
    <dc:creator>daszlosek</dc:creator>
    <dc:date>2014-09-24T15:52:25Z</dc:date>
    <item>
      <title>Two conditional IF statements</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Two-conditional-IF-statements/m-p/156348#M41009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to run a chi-square analysis on data pre vs. post an event. For example the event happened on the first day of April&amp;nbsp; 2014 and I have data for the months Jan 14, Feb 14, Mar 14 ,April 13, and May 13 prior to the event occurring. I would like to include all the data prior to the event and all data post the event and compare them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to do something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF MONTH = 'April'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND Year = 2013 THEN&amp;nbsp; EVENT&amp;nbsp; = 'PRIOR'; &lt;/P&gt;&lt;P&gt;IF MONTH = 'May'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND Year = 2013 THEN&amp;nbsp; EVENT = 'PRIOR'; &lt;/P&gt;&lt;P&gt;IF MONTH = 'January'&amp;nbsp;&amp;nbsp; AND Year = 2014 THEN EVENT&amp;nbsp; = 'PRIOR';&lt;/P&gt;&lt;P&gt;IF MONTH = 'February' AND Year = 2014 THEN EVENT&amp;nbsp; = 'PRIOR';&lt;/P&gt;&lt;P&gt;IF MONTH = 'March'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND Year =2014&amp;nbsp; THEN EVENT&amp;nbsp; = 'PRIOR'; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF MONTH = 'April'&amp;nbsp;&amp;nbsp; AND Year = 2014&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN&amp;nbsp; EVENT&amp;nbsp; = 'AFTER'; &lt;/P&gt;&lt;P&gt;IF MONTH = 'May'&amp;nbsp;&amp;nbsp; AND Year = 2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN&amp;nbsp; EVENT = 'AFTER'; &lt;/P&gt;&lt;P&gt;IF MONTH = 'June'&amp;nbsp; AND Year = 2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN EVENT&amp;nbsp; = 'AFTER'; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know AND statements do not exist in this sense. Is there a better way to approach this? I plan on running a proc freq for a chi-square analysis afterwards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 17:42:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Two-conditional-IF-statements/m-p/156348#M41009</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2014-09-23T17:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Two conditional IF statements</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Two-conditional-IF-statements/m-p/156349#M41010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What sense to you mean by "AND statements do not exist in this sense"? That is basically perfectly good data step code.&lt;/P&gt;&lt;P&gt;Could be more efficient as&lt;/P&gt;&lt;P&gt;if (month in ('April','May') and year=2013) or (month in ('January','February','March') and year = 2014) then event = 'PRIOR';&lt;/P&gt;&lt;P&gt;Else if month in ('April', 'May','June') and year=2014 then event = 'AFTER';&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 17:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Two-conditional-IF-statements/m-p/156349#M41010</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-09-23T17:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Two conditional IF statements</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Two-conditional-IF-statements/m-p/156350#M41011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Like &lt;A __default_attr="260198" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; said, your code would work but would work more quickly using if then else. However, you can do the same thing with even less code using something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input month $ year;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if input(cat(month,' 1,',year),anydtdte21.) ge '01apr2014'd then event='AFTER';&lt;/P&gt;&lt;P&gt;&amp;nbsp; else event='PRIOR';&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;April 2013&lt;/P&gt;&lt;P&gt;May 2013&lt;/P&gt;&lt;P&gt;January 2014&lt;/P&gt;&lt;P&gt;February 2014&lt;/P&gt;&lt;P&gt;March 2014&lt;/P&gt;&lt;P&gt;April 2014&lt;/P&gt;&lt;P&gt;May 2014&lt;/P&gt;&lt;P&gt;June 2014&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 18:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Two-conditional-IF-statements/m-p/156350#M41011</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-09-23T18:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Two conditional IF statements</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Two-conditional-IF-statements/m-p/156351#M41012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ballardw,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My apologies, this was more or less a lack of knowledge of SAS on my part and not being able to find an example use 'and' in an if/then statement. Plus my statement were not working correctly, but now they are.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank all of you for your help! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 15:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Two-conditional-IF-statements/m-p/156351#M41012</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2014-09-24T15:52:25Z</dc:date>
    </item>
  </channel>
</rss>

