<?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: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632462#M187521</link>
    <description>&lt;P&gt;Your second condition still does not make any sense.&amp;nbsp; COLUMN2 cannot be both between 1 and 3 and between 4 and 6 at the same time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;POST DATA.&amp;nbsp; Make it up. Type it in.&amp;nbsp; &amp;nbsp;Put it in the form of a data step that anyone can run to create a dataset that they can use to test answers. Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input id column1 column2 chargedAmount ;
cards;
1 13 1 0
1 13 1 25
1 13 1 125
2 13 4 0
2 13 4 25
2 13 4 125
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Figure out what as the answer and do the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Mar 2020 15:23:38 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-03-16T15:23:38Z</dc:date>
    <item>
      <title>Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same table.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632440#M187511</link>
      <description>&lt;P&gt;case when&lt;/P&gt;&lt;P&gt;A.col IN ('1','2','3','4')&lt;BR /&gt;AND&lt;BR /&gt;B.col NOT IN ('5','6','7')&lt;/P&gt;&lt;P&gt;then&amp;nbsp;&lt;/P&gt;&lt;P&gt;'reason'&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;P&gt;table a&lt;/P&gt;&lt;P&gt;inner join&lt;/P&gt;&lt;P&gt;table b&lt;/P&gt;&lt;P&gt;on ....&lt;/P&gt;&lt;P&gt;group by..;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get incorrect results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any other method to check if a range of values 'in'&amp;nbsp; column A and 'not in' range of values within the same table and member.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 14:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632440#M187511</guid>
      <dc:creator>Divya12</dc:creator>
      <dc:date>2020-03-16T14:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632442#M187513</link>
      <description>&lt;P&gt;Your question is not very clear. The subject says "within the same table" but you are obviously using two different tables. Your subject also says A contains (1,2,3) but your code shows 4 as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may need to provide example data from both tables to determine actual logic problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a minimum you really need to show the entire proc step. As shown you appear to be missing an "as variablename" at the end of the CASE statement.&lt;/P&gt;
&lt;PRE&gt;case when
   A.col IN ('1','2','3','4')
   AND
   B.col NOT IN ('5','6','7')
   then 'reason'
end AS RESULTVARIABLE
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Better is to copy from the log the entire procedure code and any notes, warnings or errors. Paste that copied text into a code box opened on the forum with the {I} or "running man" icon to preserve text formatting as the message windows&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doesn't work 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 {i} 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-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&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 {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 14:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632442#M187513</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-16T14:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632444#M187515</link>
      <description>&lt;P&gt;You need to show example data that describe what you have and what output you want for that sample data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your query is checking if the ONE pair of values of A.COL and B.COL are in those lists.&lt;/P&gt;
&lt;P&gt;It sounds like you instead want to test if ANY value of A.COL and ANY value of B.COL are in those lists over ALL of the observations in a group.&amp;nbsp; To do that you need to use an aggregate function, like MAX() or SUM().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table want as 
select a.id
     , case when max(A.col IN ('1','2','3','4')) AND max(B.col NOT IN ('5','6','7'))
            then 'reason' else 'NOT reason' 
       end as NEW_VAR
from have1 A
inner join have2 B
on a.id = b.id 
group by a.id
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Although perhaps you logic is slightly different than that?&amp;nbsp; That is why examples help to clarify what you want.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 14:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632444#M187515</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-16T14:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632447#M187516</link>
      <description>&lt;P&gt;Okay Let me put it up in a more clear way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to check if any of the conditions is true in the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column1= 13*&lt;/P&gt;&lt;P&gt;AND column2 IN (1, 2, 3)&lt;/P&gt;&lt;P&gt;AND&amp;nbsp; column2 not IN (4, 5, 6)&lt;/P&gt;&lt;P&gt;AND&amp;nbsp; ChargedAmount&amp;nbsp; &amp;gt; 20&lt;BR /&gt;&lt;STRONG&gt;OR&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Column1= 13* AND&lt;BR /&gt;column2 IN (1, 2, 3)&lt;/P&gt;&lt;P&gt;AND column2 IN (4, 5, 6)&lt;/P&gt;&lt;P&gt;AND ChargedAmount&amp;nbsp; &amp;gt; 100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help in coding the above specification?&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 14:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632447#M187516</guid>
      <dc:creator>Divya12</dc:creator>
      <dc:date>2020-03-16T14:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632458#M187519</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/316812"&gt;@Divya12&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Okay Let me put it up in a more clear way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to check if any of the conditions is true in the table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Column1= 13*&lt;/P&gt;
&lt;P&gt;AND column2 IN (1, 2, 3)&lt;/P&gt;
&lt;P&gt;AND&amp;nbsp; column2 not IN (4, 5, 6)&lt;/P&gt;
&lt;P&gt;AND&amp;nbsp; ChargedAmount&amp;nbsp; &amp;gt; 20&lt;BR /&gt;&lt;STRONG&gt;OR&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Column1= 13* AND&lt;BR /&gt;column2 IN (1, 2, 3)&lt;/P&gt;
&lt;P&gt;AND column2 IN (4, 5, 6)&lt;/P&gt;
&lt;P&gt;AND ChargedAmount&amp;nbsp; &amp;gt; 100&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you help in coding the above specification?&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And to reiterate: Show the exact code that you are trying that "does not work".&lt;/P&gt;
&lt;P&gt;I suspect that you have a serious problem because&lt;/P&gt;
&lt;P&gt;column1=13* is going to throw all sorts of errors. If column1 is numeric then the you will get a message about attempting to convert "13*" to a numeric value for comparison and failing with invalid values. If Column1 is character then you might get a comparison but I am not going to even try to test it without your data. Character values really should be in quotes: &amp;nbsp;="13*"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As another main point of logic you likely need to group the values if you need all of those things separated by OR to evaluate as true:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(
Column1= 13*

AND column2 IN (1, 2, 3)

AND  column2 not IN (4, 5, 6)

AND  ChargedAmount  &amp;gt; 20
)
OR
(
Column1= 13* AND
column2 IN (1, 2, 3)

AND column2 IN (4, 5, 6)

AND ChargedAmount  &amp;gt; 100
)
&lt;/PRE&gt;
&lt;P&gt;But that will &lt;STRONG&gt;fail&lt;/STRONG&gt; because column2 cannot ever be in (1 2 3) and (4 5 6) at the same time. Ever. Really. So you still need to post example data in the form of a data step &lt;STRONG&gt;and&lt;/STRONG&gt; the actual code you are attempting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 15:21:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632458#M187519</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-16T15:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632462#M187521</link>
      <description>&lt;P&gt;Your second condition still does not make any sense.&amp;nbsp; COLUMN2 cannot be both between 1 and 3 and between 4 and 6 at the same time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;POST DATA.&amp;nbsp; Make it up. Type it in.&amp;nbsp; &amp;nbsp;Put it in the form of a data step that anyone can run to create a dataset that they can use to test answers. Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input id column1 column2 chargedAmount ;
cards;
1 13 1 0
1 13 1 25
1 13 1 125
2 13 4 0
2 13 4 25
2 13 4 125
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Figure out what as the answer and do the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 15:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632462#M187521</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-16T15:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632471#M187526</link>
      <description>&lt;P&gt;I need to check if the member has a particular claim(&lt;STRONG&gt;COL) (1,2,3)&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp;but should not contain sub claim (4,5,6)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So first condition:&lt;/P&gt;&lt;P&gt;Billtype contains 13%&lt;/P&gt;&lt;P&gt;and Col in (1, 2, 3)&lt;/P&gt;&lt;P&gt;but Col not in (4,5,6)&lt;/P&gt;&lt;P&gt;and the chargedamount&amp;gt;20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So the first condition would not be satisfied because we need only members who have col(1,2,3) but not (4,5,6) within the subquery&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second Condition:&lt;/P&gt;&lt;P&gt;Billtype contains 13%&lt;/P&gt;&lt;P&gt;and Col in (1, 2, 3)&lt;/P&gt;&lt;P&gt;and Col in (4,5,6)&lt;/P&gt;&lt;P&gt;and the chargedamount&amp;gt;100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second condition will be satisfied as Col&amp;nbsp;contains (1,2,3) and also (4,5,6) and charged amount&amp;gt;100&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&lt;STRONG&gt;NPUT:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;client id&lt;/TD&gt;&lt;TD&gt;Order ID&lt;/TD&gt;&lt;TD&gt;billtype&lt;/TD&gt;&lt;TD&gt;col&lt;/TD&gt;&lt;TD&gt;Chargedamount&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;138&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;138&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;137&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;136&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;139&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;137&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;700&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OUTPUT:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;139&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;137&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;700&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 16 Mar 2020 15:52:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632471#M187526</guid>
      <dc:creator>Divya12</dc:creator>
      <dc:date>2020-03-16T15:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632480#M187531</link>
      <description>&lt;P&gt;Why are you outputting only the last two observations?&amp;nbsp; What was the criteria that eliminated the other rows?&lt;/P&gt;
&lt;P&gt;If the test for 1,2,3 or 4,5,6 is supposed to go across observations I would think you would either keep all of the observations for a CLIENT_ID or none of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Posting a report/spreadsheet/table is better than no data, but a dataset is better still.&amp;nbsp; Looking at your report we cannot tell if BILLTYPE is numeric or character.&amp;nbsp; Let's assume only COL and CHARGEDAMOUNT are numbers and the others a characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input client_id $ Order_ID $ billtype $ col Chargedamount;
cards;
1 1 138 1 20
1 2 138 4 5
1 3 137 2 10
1 4 136 3 25
1 5 139 5 150
1 6 137 6 700
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 16:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632480#M187531</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-16T16:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632481#M187532</link>
      <description>Because the Col has (1,2,3) and col (4,5,6) and having charged Amount &amp;gt;100</description>
      <pubDate>Mon, 16 Mar 2020 16:23:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632481#M187532</guid>
      <dc:creator>Divya12</dc:creator>
      <dc:date>2020-03-16T16:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632483#M187534</link>
      <description>&lt;P&gt;Are you trying to do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input client_id $ Order_ID $ billtype $ col Chargedamount;
cards;
1 1 138 1 20
1 2 138 4 5
1 3 137 2 10
1 4 136 3 25
1 5 139 5 150
1 6 137 6 700
;

data test1;
  set have;
  rule1 =(billtype =: '13') and (col in (1:3)) and (chargedamount&amp;gt;20) ;
  rule2 =(billtype =: '13') and (col in (1:6)) and (chargedamount&amp;gt;100) ;
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;       client_
Obs      id       Order_ID    billtype    col    Chargedamount    rule1    rule2

 1        1          1          138        1           20           0        0
 2        1          2          138        4            5           0        0
 3        1          3          137        2           10           0        0
 4        1          4          136        3           25           1        0
 5        1          5          139        5          150           0        1
 6        1          6          137        6          700           0        1
&lt;/PRE&gt;
&lt;P&gt;In which case it looks like the result of your second rule only is what you want from this set of example data.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 16:27:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632483#M187534</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-16T16:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632486#M187535</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/316812"&gt;@Divya12&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Because the Col has (1,2,3) and col (4,5,6) and having charged Amount &amp;gt;100&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No.&amp;nbsp; For ORDERID 5 and 6 the value of COL is in 4 to 6.&amp;nbsp; An individual value cannot be both &amp;lt;4 and &amp;gt;3 at the same.&lt;/P&gt;
&lt;P&gt;So you want to use OR instead of AND there.&amp;nbsp; Or just use one IN operator with the full list of possible values.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 16:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632486#M187535</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-16T16:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632500#M187536</link>
      <description>For example.&lt;BR /&gt;&lt;BR /&gt;I am a member who is having a condition col(1,2,3) but i should not have condition col(4,5,6) and charged amt&amp;gt;25..&lt;BR /&gt;&lt;BR /&gt;I am a member who is having conditions(1,2,3) and also conditions (4,5,6) and my chargedamount&amp;gt;100</description>
      <pubDate>Mon, 16 Mar 2020 17:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632500#M187536</guid>
      <dc:creator>Divya12</dc:creator>
      <dc:date>2020-03-16T17:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Check if values in 'A' column contains (1,2,3) but does not contain (4,5,6) within the same tabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632509#M187537</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/316812"&gt;@Divya12&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;For example.&lt;BR /&gt;&lt;BR /&gt;I am a member who is having a condition col(1,2,3) but i should not have condition col(4,5,6) and charged amt&amp;gt;25..&lt;BR /&gt;&lt;BR /&gt;I am a member who is having conditions(1,2,3) and also conditions (4,5,6) and my chargedamount&amp;gt;100&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So some concrete examples.&amp;nbsp; Show examples of members that have data such that you want to include that member and examples with values that mean you want to exclude that member.&amp;nbsp; Also be clear about what you want the result to be.&amp;nbsp; You previous example the output looked like the input but only some of the observations were selected, even though all of the observations were for the same CLIENT_ID (which I assume means MEMBER).&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 17:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-if-values-in-A-column-contains-1-2-3-but-does-not-contain/m-p/632509#M187537</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-16T17:56:48Z</dc:date>
    </item>
  </channel>
</rss>

