<?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: Understand Each Conditions Affect on My Data Set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324943#M72209</link>
    <description>&lt;P&gt;Since you don't have any 2015 Ford or BMWs, the following will come close to what you want. You could use proc tabulate to get the precise output you indicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Have;&lt;BR /&gt;Length CustomerID 8 ModelYear $ 4 Vehicle $ 20;&lt;BR /&gt;Infile Datalines Missover;&lt;BR /&gt;Input CustomerID ModelYear Vehicle;&lt;BR /&gt;Datalines;&lt;BR /&gt;001 2013 Ford&lt;BR /&gt;002 2014 Citroen&lt;BR /&gt;003 2015 Volkswagen&lt;BR /&gt;004 2016 Audi&lt;BR /&gt;005 2013 BMW&lt;BR /&gt;006 2013 Ford&lt;BR /&gt;007 2014 Citroen&lt;BR /&gt;008 2015 Volkswagen&lt;BR /&gt;009 2016 Audi&lt;BR /&gt;010 2013 BMW&lt;BR /&gt;011 2013 Ford&lt;BR /&gt;012 2014 Citroen&lt;BR /&gt;013 2015 Volkswagen&lt;BR /&gt;014 2016 Audi&lt;BR /&gt;015 2013 BMW&lt;BR /&gt;016 2013 Ford&lt;BR /&gt;017 2014 Citroen&lt;BR /&gt;018 2015 Volkswagen&lt;BR /&gt;019 2016 Audi&lt;BR /&gt;020 2013 BMW&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;BR /&gt;proc format;&lt;BR /&gt; value cond&lt;BR /&gt; 1='Vehicle NOT IN('Ford','BMW')'&lt;BR /&gt; 2="ModelYear in('2015')"&lt;BR /&gt; other=.&lt;BR /&gt; ;&lt;BR /&gt;run;&lt;BR /&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; if vehicle in ('Ford','BMW') then condition=1;&lt;BR /&gt; else if ModelYear in ('2015') then condition=2;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc freq data=want;&lt;BR /&gt; tables condition/missing nocum;&lt;BR /&gt; format condition cond.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jan 2017 01:24:38 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-01-16T01:24:38Z</dc:date>
    <item>
      <title>Understand Each Conditions Affect on My Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324928#M72198</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a sample code as below and I have few condition statements to decrease size of the data set. At this stage, my purpose is to get effect of conditions. What I mean is to find out how much percentage/count of decrease conditions seperately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my sample code;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;
Length CustomerID 8 ModelYear $ 4 Vehicle $ 20;
Infile Datalines Missover;
Input CustomerID ModelYear Vehicle;
Datalines;
001 2013 Ford
002 2014 Citroen
003 2015 Volkswagen
004 2016 Audi
005 2013 BMW
006 2013 Ford
007 2014 Citroen
008 2015 Volkswagen
009 2016 Audi
010 2013 BMW
011 2013 Ford
012 2014 Citroen
013 2015 Volkswagen
014 2016 Audi
015 2013 BMW
016 2013 Ford
017 2014 Citroen
018 2015 Volkswagen
019 2016 Audi
020 2013 BMW
;
Run;
Proc Sql;
Create Table Want As
Select *
From Have
/*First condition*/Where Vehicle NOT IN('Ford','BMW') 
/*Second condition*/And ModelYear In('2015'); 
Quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And here is my desired output;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6731i596F7C2FDDD9E5F7/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Sample.png" title="Sample.png" /&gt;&lt;/P&gt;
&lt;P&gt;What SAS code should I write to get my desired output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jan 2017 23:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324928#M72198</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2017-01-15T23:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Understand Each Conditions Affect on My Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324934#M72202</link>
      <description>&lt;P&gt;They're not mutually exclusive though. A record could meet both conditions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For this use a SQL query.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sum(condition) &amp;nbsp;as condition1,&lt;/P&gt;
&lt;P&gt;sum(condition) as condition2&amp;nbsp;&lt;/P&gt;
&lt;P&gt;from have ;&lt;/P&gt;
&lt;P&gt;quit;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 00:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324934#M72202</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-16T00:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Understand Each Conditions Affect on My Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324943#M72209</link>
      <description>&lt;P&gt;Since you don't have any 2015 Ford or BMWs, the following will come close to what you want. You could use proc tabulate to get the precise output you indicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Have;&lt;BR /&gt;Length CustomerID 8 ModelYear $ 4 Vehicle $ 20;&lt;BR /&gt;Infile Datalines Missover;&lt;BR /&gt;Input CustomerID ModelYear Vehicle;&lt;BR /&gt;Datalines;&lt;BR /&gt;001 2013 Ford&lt;BR /&gt;002 2014 Citroen&lt;BR /&gt;003 2015 Volkswagen&lt;BR /&gt;004 2016 Audi&lt;BR /&gt;005 2013 BMW&lt;BR /&gt;006 2013 Ford&lt;BR /&gt;007 2014 Citroen&lt;BR /&gt;008 2015 Volkswagen&lt;BR /&gt;009 2016 Audi&lt;BR /&gt;010 2013 BMW&lt;BR /&gt;011 2013 Ford&lt;BR /&gt;012 2014 Citroen&lt;BR /&gt;013 2015 Volkswagen&lt;BR /&gt;014 2016 Audi&lt;BR /&gt;015 2013 BMW&lt;BR /&gt;016 2013 Ford&lt;BR /&gt;017 2014 Citroen&lt;BR /&gt;018 2015 Volkswagen&lt;BR /&gt;019 2016 Audi&lt;BR /&gt;020 2013 BMW&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;BR /&gt;proc format;&lt;BR /&gt; value cond&lt;BR /&gt; 1='Vehicle NOT IN('Ford','BMW')'&lt;BR /&gt; 2="ModelYear in('2015')"&lt;BR /&gt; other=.&lt;BR /&gt; ;&lt;BR /&gt;run;&lt;BR /&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; if vehicle in ('Ford','BMW') then condition=1;&lt;BR /&gt; else if ModelYear in ('2015') then condition=2;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc freq data=want;&lt;BR /&gt; tables condition/missing nocum;&lt;BR /&gt; format condition cond.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 01:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324943#M72209</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-16T01:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Understand Each Conditions Affect on My Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324944#M72210</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Since you don't have any 2015 Ford or BMWs, the following will come close to what you want. You could use proc tabulate to get the precise output you indicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;I no longer trust the 'sample' data to reflect the actual situation, experience says the next question is what if there's multiples/by groups/overlaps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 01:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324944#M72210</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-16T01:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Understand Each Conditions Affect on My Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324960#M72215</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;: I agree, but that's also something newbees have to learn.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 04:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324960#M72215</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-16T04:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Understand Each Conditions Affect on My Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324983#M72221</link>
      <description>&lt;P&gt;Thank you so much but this statement works like true/false logic. I mean if the condition is true then it brings "1" if it is false brings "0". How can I display these values as percentage and count in Proc Sql statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 08:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/324983#M72221</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2017-01-16T08:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Understand Each Conditions Affect on My Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/325003#M72229</link>
      <description>&lt;P&gt;For a binary variable&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SUM -&amp;gt; count&lt;/P&gt;
&lt;P&gt;MEAN -&amp;gt; percentage&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 10:49:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/325003#M72229</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-16T10:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Understand Each Conditions Affect on My Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/325007#M72230</link>
      <description>&lt;P&gt;Thank you so much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 11:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understand-Each-Conditions-Affect-on-My-Data-Set/m-p/325007#M72230</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2017-01-16T11:19:31Z</dc:date>
    </item>
  </channel>
</rss>

