<?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: Simple way to remove the missings when you count distinct? in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/270621#M4215</link>
    <description>&lt;P&gt;Worked it out.. &amp;nbsp;This just checks to see if there is 1 or more missing using same aggregate and the -1 if there is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3174i05F4F8BE2D385FC8/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="sasva.png" title="sasva.png" /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 16 May 2016 01:47:54 GMT</pubDate>
    <dc:creator>McGoo</dc:creator>
    <dc:date>2016-05-16T01:47:54Z</dc:date>
    <item>
      <title>Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175565#M1135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, this might be a really dumb question, but I haven't found a way around this one.&lt;/P&gt;&lt;P&gt;Whenever I create distinct values from a category, it counts all the missings from that category as 1, asi it should. However, I can't think of a SIMPLE way of removing those 'missing' values from the distinct calculation (e.g: Column A values values: 1, 2, 3, missing, missing. Distinct by group (column A) = 4, I would like it to be 3). I can imagine some workarounds, marking as 1 or 0 if a certain value has certain properties and then do a sum by group, but that is what I'm trying to avoid. Has anybody come across this and can provide a solution?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Santiago&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 20:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175565#M1135</guid>
      <dc:creator>starnassi</dc:creator>
      <dc:date>2015-02-19T20:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175566#M1136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this may want a small example start data set and what the final results should look like.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 23:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175566#M1136</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-02-19T23:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175567#M1137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Santiago,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use Data Source Filter, it remove blank or missing values from table level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Teja Surapaneni. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 09:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175567#M1137</guid>
      <dc:creator>TejaSurapaneni</dc:creator>
      <dc:date>2015-02-24T09:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175568#M1138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What keeps you from using a where condition to exclude the missing values?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 11:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175568#M1138</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-02-24T11:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175569#M1139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where are you seeing this , in a SAS dataset?&amp;nbsp; if you perform a proc sql over a SAS dataset, then it'll exclude the null/missing values while using Count(). If you are querying from a Database, then you may want to use a function to handle the NULLs before you can perform a count().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use ISNULL() , IFNULL() or COALESCE() etc depending on which function your database is supporting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 13:33:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175569#M1139</guid>
      <dc:creator>Karthikeyan</dc:creator>
      <dc:date>2015-02-24T13:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175570#M1140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys, thank you all for the answers so far.&lt;/P&gt;&lt;P&gt;I could remove the missings from the dataset, but given the workflow within the company, it is a request someone else should do and this takes a long time. To avoid this is why I'm looking for a for a way to do this in Visual Analytics using only calculated elements and filters. Sadly, I cannot use a where clause when making a new aggregated measure (distint by group in this case). BTW, I'm aware that this might not be possible, I'm just wondering if someone had a handy solution without modifying the dataset.&lt;/P&gt;&lt;P&gt;Here's an example of the table I'm working with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Modelo Tabla.PNG" class="jive-image" src="https://communities.sas.com/legacyfs/online/9359_Modelo Tabla.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 14:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175570#M1140</guid>
      <dc:creator>starnassi</dc:creator>
      <dc:date>2015-02-24T14:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175571#M1141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards;&lt;/P&gt;&lt;P&gt;input&lt;/P&gt;&lt;P&gt;&amp;nbsp; category :$1.&lt;/P&gt;&lt;P&gt;&amp;nbsp; pid :1.&lt;/P&gt;&lt;P&gt;&amp;nbsp; cid :1.&lt;/P&gt;&lt;P&gt;&amp;nbsp; sid :1.&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;A 1 1 1&lt;/P&gt;&lt;P&gt;A 2 1 .&lt;/P&gt;&lt;P&gt;A 3 2 .&lt;/P&gt;&lt;P&gt;A . . .&lt;/P&gt;&lt;P&gt;B 2 1 2&lt;/P&gt;&lt;P&gt;B 3 2 .&lt;/P&gt;&lt;P&gt;B 4 3 3&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;count(distinct pid) as pid, count(distinct cid) as cid, count(distinct sid) as sid&lt;/P&gt;&lt;P&gt;from have;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gives me exactly the result you wanted:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;pid&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;cid&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;sid&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;----------------------------&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 06:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/175571#M1141</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-02-25T06:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/270577#M4213</link>
      <description>&lt;P&gt;Hi starnassi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you ever work out a solution, I just came across a problem that now has this problem too.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking you could do the distinct count -1 but not sure I can be sure there will always be a MISSING value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I too need to do in SASVA rather than data prep as I am looking to do the distinct count on an calculated item with an IF ELSE statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2016 08:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/270577#M4213</guid>
      <dc:creator>McGoo</dc:creator>
      <dc:date>2016-05-15T08:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/270621#M4215</link>
      <description>&lt;P&gt;Worked it out.. &amp;nbsp;This just checks to see if there is 1 or more missing using same aggregate and the -1 if there is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3174i05F4F8BE2D385FC8/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="sasva.png" title="sasva.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2016 01:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/270621#M4215</guid>
      <dc:creator>McGoo</dc:creator>
      <dc:date>2016-05-16T01:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to remove the missings when you count distinct?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/375166#M7617</link>
      <description>works perfectly. Thankyou!</description>
      <pubDate>Wed, 12 Jul 2017 00:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Simple-way-to-remove-the-missings-when-you-count-distinct/m-p/375166#M7617</guid>
      <dc:creator>mcgarrick</dc:creator>
      <dc:date>2017-07-12T00:36:01Z</dc:date>
    </item>
  </channel>
</rss>

