<?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: What is the logic for this if statment that I need to use it proc sql? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818235#M322980</link>
    <description>&lt;P&gt;You need to explain what it is you are trying to do as the statement you posted is invalid.&amp;nbsp; What goes after the THEN in and IF/THEN statement is another statement.&amp;nbsp; Instead you just have another comparison.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jun 2022 00:09:25 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-06-15T00:09:25Z</dc:date>
    <item>
      <title>What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818231#M322978</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I need to write a couple of if statements, how can I do it?&lt;/P&gt;
&lt;P&gt;If LineOfBusiness eq 'Medicare' Then Measure in ( AAB, CCD)...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should I map one one one?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason for this that some of the measures are not mapping to that LineofBusiness and they are not available for some specific Line of businesses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do this in proc sql in a case statement or in an if statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 23:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818231#M322978</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-14T23:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818235#M322980</link>
      <description>&lt;P&gt;You need to explain what it is you are trying to do as the statement you posted is invalid.&amp;nbsp; What goes after the THEN in and IF/THEN statement is another statement.&amp;nbsp; Instead you just have another comparison.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 00:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818235#M322980</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-15T00:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818237#M322981</link>
      <description>&lt;P&gt;Using a CASE statement is the way to go with SQL. The IF statement isn't available. It isn't clear from what you've posted what rules you want to apply. Start by writing it in English, then it is easy to create a CASE statement.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 00:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818237#M322981</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-06-15T00:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818379#M323032</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;To give you some context:&lt;/P&gt;
&lt;P&gt;I have measures such as measure a, measure b, measure c, measure d&lt;/P&gt;
&lt;P&gt;I have Line of business such Medicare, Medicaid, Covered California, Exchange HMO&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now not all Line of businesses have these measures.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;Medicare has measure a, measure b, measure c&lt;/P&gt;
&lt;P&gt;Medicaid has measure a, measure b, measure d&lt;/P&gt;
&lt;P&gt;Covered California has measure d, measure a&lt;/P&gt;
&lt;P&gt;and so on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to put these in a proc sql.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate your stepping in!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 16:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818379#M323032</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T16:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818382#M323034</link>
      <description>&lt;P&gt;Please read the top part.&lt;/P&gt;
&lt;P&gt;I posted some explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 16:21:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818382#M323034</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T16:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818403#M323037</link>
      <description>&lt;P&gt;I still do not see any actual question here.&lt;/P&gt;
&lt;P&gt;What are the VARIABLES that you have?&amp;nbsp; What type are they? Numeric or Character?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds a little like you are trying to say you have two variables.&lt;/P&gt;
&lt;P&gt;One might be INSURANCE which can have values like 'Medicare' or 'Medicaid'.&amp;nbsp; So that would need to be a character variable.&amp;nbsp; Or if it was a numeric variable with values like 1,2,3,etc you could use a fomat to display the numbers as those descriptive string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another might be MEASURE which could have values like 'A' or 'B'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now what does the full dataset consist of?&amp;nbsp; Are you tracking individual insurance companies and whether they provide insurance policies under Medicare or Medicaid?&amp;nbsp; Are you tracking individual people and what insurance they have?&amp;nbsp; Are you tracking the billing for individual procedures that a patient received and what insurance was used to pay for that procedure?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you describe the data you have you can then try to explain what you are trying to do that you need help with.&lt;/P&gt;
&lt;P&gt;Are you having trouble entering the data into the dataset?&lt;/P&gt;
&lt;P&gt;Are you trying to test if the data in the dataset follows some rules? What rules? What do want to do if the rules are violated?&lt;/P&gt;
&lt;P&gt;Are you trying to convert data from one format to another?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 16:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818403#M323037</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-15T16:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818417#M323039</link>
      <description>&lt;P&gt;Hello Tom,&lt;/P&gt;
&lt;P&gt;As simple as I said.&lt;/P&gt;
&lt;P&gt;None of the cases you said. If I want to explain what our department does, that makes it more complicated and I need to explain about the strategy of United States Health plans.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of the insurances don't have all measures.&lt;/P&gt;
&lt;P&gt;As simple as this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;if LineOfBusiness eq 'Medicare' then measure eq 'measure A'&lt;/P&gt;
&lt;P&gt;if LineOfBusiness eq 'Medicare' then measure eq 'measure B'&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if LineOfBusiness eq 'Medicare' then measure in ('measure A', 'measure B',..)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to add this to a proc sql which is already there. I need to add this part to my code.&lt;/P&gt;
&lt;P&gt;No need to change the code because that brings more complication. I need to add this part to my code only.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 17:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818417#M323039</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T17:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818422#M323040</link>
      <description>&lt;P&gt;That is not code and it is not a description.&lt;/P&gt;
&lt;P&gt;In particular what do you mean by this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if LineOfBusiness eq 'Medicare' then measure eq 'measure A'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the second EQ was an equal sign then it is a valid statement that means when LINEOFBUSINESS is 'Medicare' then set MEASURE to 'measure A'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you just trying to express a complex boolean expression?&amp;nbsp; If so then use AND and not IF/THEN.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(LineOfBusiness eq 'Medicare') and ( measure eq 'measure A')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That expression will be true when LINEOFBUSINESS is 'Medicare' and MEASURE is 'measure A'.&lt;/P&gt;
&lt;P&gt;You could then use such an expression in a IF/THEN statement.&amp;nbsp; Or in SQL in the WHEN part of a CASE expression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In either case what do want to DO when the expression is true?&amp;nbsp; What do you want to do when the expression is false?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 18:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818422#M323040</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-15T18:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818425#M323041</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;What I am trying to do is when line of business is Medicare, then measures such sas measureA, MeasureB and MeasureC are applied to Medicare line of business.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should I say?&lt;/P&gt;
&lt;P&gt;If LineofBusiness eq upcase(Medicare) Then measure in ('measureA', 'measureB', 'Measurec');&lt;/P&gt;
&lt;P&gt;If LineofBusiness eq upcase(Commercial) Then measure in ('measureA', 'measureB', 'MeasureD');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a proc sql that selects LineofBusiness and measure, I need to add the part on the top to this proc sql.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;p.s. Each record has one line of business and one measure in the measure field. How do I need to write this code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 18:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818425#M323041</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T18:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818449#M323045</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;What I am trying to do is when line of business is Medicare, then measures such sas measureA, MeasureB and MeasureC are applied to Medicare line of business.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should I say?&lt;/P&gt;
&lt;P&gt;If LineofBusiness eq upcase(Medicare) Then measure in ('measureA', 'measureB', 'Measurec');&lt;/P&gt;
&lt;P&gt;If LineofBusiness eq upcase(Commercial) Then measure in ('measureA', 'measureB', 'MeasureD');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a proc sql that selects LineofBusiness and measure, I need to add the part on the top to this proc sql.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;p.s. Each record has one line of business and one measure in the measure field. How do I need to write this code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You are still not describing anything concrete.&amp;nbsp; Once you can describe you can probably code it yourself.&lt;/P&gt;
&lt;P&gt;Are you saying you have a QUERY written in SQL syntax that is selecting records from an existing dataset that has a variable named&amp;nbsp;LineofBusiness and a variable named measure and you want to subset to just those observations where the combination of LINEOFBUSINESS and MEASURE are in a limited set of values?&lt;/P&gt;
&lt;P&gt;So perhaps something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select * 
from have
where (LineofBusiness eq upcase('Medicare')   and measure in ('measureA', 'measureB', 'Measurec') )
   or (LineofBusiness eq upcase('Commercial') and measure in ('measureA', 'measureB', 'MeasureD') )
;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So it would exclude observations where measure was 'MeasureD' but LINEOFBUSINESS was not 'COMMERCIAL'.&lt;/P&gt;
&lt;P&gt;Basically exclude the combinations that had an invalid MEASURE for that line of business.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 19:06:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818449#M323045</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-15T19:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818452#M323046</link>
      <description>&lt;P&gt;Hello Tom,&lt;/P&gt;
&lt;P&gt;I don't need "and" or "or"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I said if line of business is medicare then measures are measure A, measure B, measure c&lt;/P&gt;
&lt;P&gt;This is what I want in code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;bitter &amp;amp; sweet&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 19:15:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818452#M323046</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T19:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818453#M323047</link>
      <description>&lt;P&gt;Hello Tom,&lt;/P&gt;
&lt;P&gt;Invalid measure is taken care of in a different part of the code.&lt;/P&gt;
&lt;P&gt;Whatever we have is valid measures and valid line of business.&lt;/P&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;bitter &amp;amp; sweet&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 19:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818453#M323047</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T19:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818454#M323048</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;How can I write this in a code either in if statement or case statement?&lt;/P&gt;
&lt;P&gt;If lineofbusiness is medicare then measures are measureA, measureB, measurec.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 19:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818454#M323048</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T19:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818456#M323049</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;How can I write this in a code either in if statement or case statement?&lt;/P&gt;
&lt;P&gt;If lineofbusiness is medicare then measures are measureA, measureB, measurec.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If lineofbusiness is medicare is a TEST of the value of a variable.&amp;nbsp; So what do want to HAPPEN then?&amp;nbsp; You cannot set the value of MEASURE to three different values. It can only have one at a time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a data step you could GENERATE multiple observations using code like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  if lineofbusiness = 'Medicare' then do measure = 'measureA', 'measureB', 'measurec';
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So every observation that met the IF condition is converted into three observations where each one has a different value of measure.&amp;nbsp; Is that what you are trying to DO .&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 19:26:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818456#M323049</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-15T19:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818489#M323072</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; To offer a different perspective, this seems like a table lookup possibility with a user-defined format more than an IF, DO or CASE application. With a long list of possibilities, if only one variable is needed (called Measure in my program), then a user-defined format can accomplish that. I've put an example below with some fake data, so you can see the approach.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1655327584078.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72358i59FB61FC881E6E05/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1655327584078.png" alt="Cynthia_sas_0-1655327584078.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 21:13:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818489#M323072</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-06-15T21:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818491#M323073</link>
      <description>&lt;P&gt;Hello Cyntia,&lt;/P&gt;
&lt;P&gt;Thanks for the response.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my table in real life:&lt;/P&gt;
&lt;P&gt;measure&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;coveredCalifornia&amp;nbsp; &amp;nbsp; Medicare&amp;nbsp; &amp;nbsp; Medicaid HMO&lt;/P&gt;
&lt;P&gt;measureA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N/A&lt;/P&gt;
&lt;P&gt;measureB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N/A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&lt;/P&gt;
&lt;P&gt;measureC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N/A&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, I want the result doesn't show the measure when it is N/A for a healthplan.&lt;/P&gt;
&lt;P&gt;That is the best I can explain it.&lt;/P&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 21:56:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818491#M323073</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T21:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818492#M323074</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello Cyntia,&lt;/P&gt;
&lt;P&gt;Thanks for the response.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my table in real life:&lt;/P&gt;
&lt;P&gt;measure&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;coveredCalifornia&amp;nbsp; &amp;nbsp; Medicare&amp;nbsp; &amp;nbsp; Medicaid HMO&lt;/P&gt;
&lt;P&gt;measureA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N/A&lt;/P&gt;
&lt;P&gt;measureB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N/A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&lt;/P&gt;
&lt;P&gt;measureC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N/A&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, I want the result doesn't show the measure when it is N/A for a healthplan.&lt;/P&gt;
&lt;P&gt;That is the best I can explain it.&lt;/P&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now you are getting closer.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that table looks to me like it might be the description of the rules about which plans cover which "measure" (whatever you mean by that).&lt;/P&gt;
&lt;P&gt;Now the question is what does the actual data you are trying to operate on look like?&lt;/P&gt;
&lt;P&gt;That would probably look something more like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
   input id :$10. date :date. measure :$10.&amp;nbsp;cost&amp;nbsp;plan $20.;
cards;
1&amp;nbsp;01JAN2022&amp;nbsp;MeasureA&amp;nbsp;100 Medicare
1&amp;nbsp;02FEB2022&amp;nbsp;MeasureB 200.50 Medicare
2&amp;nbsp;03MAR2022&amp;nbsp;MeasureC&amp;nbsp;10.75 coveredCalifornia
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So take your coverage table and convert into a tall format instead:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data coverage;
  input measure :$10. @;
  length plan $20 coverstring $3 covered 8;
  do plan= 'coveredCalifornia','Medicare', 'Medicaid HMO';
    input coverstring @ ;
    covered = (coverstring='X');
    output;
  end;
cards;
measureA                          X                           X              N/A
measureB                         N/A                         X              X
measureC                        X                              X             N/A
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you have a useful dataset like this:&lt;/P&gt;
&lt;PRE&gt; Obs    measure     plan                 coverstring    covered
  1     measureA    coveredCalifornia        X             1   
  2     measureA    Medicare                 X             1   
  3     measureA    Medicaid HMO             N/A           0   
  4     measureB    coveredCalifornia        N/A           0   
  5     measureB    Medicare                 X             1   
  6     measureB    Medicaid HMO             X             1   
  7     measureC    coveredCalifornia        X             1   
  8     measureC    Medicare                 X             1   
  9     measureC    Medicaid HMO             N/A           0  &lt;/PRE&gt;
&lt;P&gt;Now you can combine your coverage table with the actual data at create the COVERED flag to indicate if the event is covered by that plan.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select a.*, b.covered
   from have a
  left join coverage b
  on a.plan = b.plan and a.measure = b.measure
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jun 2022 22:12:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818492#M323074</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-15T22:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818493#M323075</link>
      <description>&lt;P&gt;Hello Cynthia,&lt;/P&gt;
&lt;P&gt;The join is already happened in a proc sql and I'd like the rule for which I showed a table to be applied.&lt;/P&gt;
&lt;P&gt;I need to add this rule to a proc sql by if statement or case when.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate your response.&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 22:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818493#M323075</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T22:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818494#M323076</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello Cynthia,&lt;/P&gt;
&lt;P&gt;The join is already happened in a proc sql and I'd like the rule for which I showed a table to be applied.&lt;/P&gt;
&lt;P&gt;I need to add this rule to a proc sql by if statement or case when.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate your response.&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Either add another JOIN to the SQL to combine the coverage table.&lt;/P&gt;
&lt;P&gt;Or convert the table into the code I posted before with the OR that you said you did not want.&amp;nbsp; For example using a CASE clause to create another variable in the list of variables being selected by the SQL query.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when (plan='Medicare' and measure in ('measureA','measuerB')) then 1
     when (plan='Medicaid' and measure in ('measureA','measureC')) then 1
         ...
     else 0
end as coverage&lt;/CODE&gt;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 23:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818494#M323076</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-15T23:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: What is the logic for this if statment that I need to use it proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818495#M323077</link>
      <description>&lt;P&gt;Hello Tom,&lt;/P&gt;
&lt;P&gt;Yes, This is what I am looking for. In prior posts, I said no "and" or "or", I was wrong. Can we put the code in a way that if the condition is met, then don't bring that row in to the result. I mean delete that row.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Bitter &amp;amp; Sweet&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 23:34:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-logic-for-this-if-statment-that-I-need-to-use-it/m-p/818495#M323077</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-06-15T23:34:20Z</dc:date>
    </item>
  </channel>
</rss>

