<?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: Count distinct values when missing fields/Notmissing fields in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202089#M1815</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ajay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if you’ve considered using the data builder in SASVA, but it sounds like it could be a good option for what you need to accomplish. From the data builder, you can create data queries and filter using the ‘Where’ tab. You can find more information here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/vaug/68027/HTML/default/viewer.htm#p0ef9qegein6kon1dy9qm4szawnp.htm"&gt;http://support.sas.com/documentation/cdl/en/vaug/68027/HTML/default/viewer.htm#p0ef9qegein6kon1dy9qm4szawnp.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you prefer, you can also modify the code directly on the ‘Code’ tab in the data query. You can find more information here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/vaug/68027/HTML/default/viewer.htm#p1bhe7s7u4l7egn1d2ahwvqw34is.htm"&gt;http://support.sas.com/documentation/cdl/en/vaug/68027/HTML/default/viewer.htm#p1bhe7s7u4l7egn1d2ahwvqw34is.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;(If you use this method, be sure to save the data query at least once before you unlock the code)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need more information, please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Lorrie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jun 2015 13:43:15 GMT</pubDate>
    <dc:creator>Lorrie_SAS</dc:creator>
    <dc:date>2015-06-10T13:43:15Z</dc:date>
    <item>
      <title>Count distinct values when missing fields/Notmissing fields</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202085#M1811</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;I have a dataset, where I have to make relation with missing to Notmissing for quality indicators. How ever, I didnot find the solution to count distinct observation for var1 when var2 is missing. Or count distinct observations of var1 when var2 is not missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="147.66666662693024" style="border: 1px solid rgb(0, 0, 0); width: 301.66666662693px; height: 133.66666662693px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Prescriptions&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Indications&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Pres1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Indicat1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Pres2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Pres3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Pres4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Indcat2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Pres5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Indicat3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I am looking for a solution in SAS VA where I could 2 counts &lt;/P&gt;&lt;P&gt;1.) All distinct count of prescription when the indications are missing&lt;/P&gt;&lt;P&gt;2.) All distinct count of prescriptions when indications are not missing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any tips will be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ajay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 09:57:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202085#M1811</guid>
      <dc:creator>vasireddyajay</dc:creator>
      <dc:date>2015-06-10T09:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct values when missing fields/Notmissing fields</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202086#M1812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a simplified version of what you are asking, if you are looking for something more than this let me know:&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards dsd;&lt;/P&gt;&lt;P&gt;input Prescriptions $ Indications $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;Pres1,Indicat1&lt;/P&gt;&lt;P&gt;Pres2,,&lt;/P&gt;&lt;P&gt;Pres3,,&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Pres4,Indcat2&lt;/P&gt;&lt;P&gt;Pres5,Indicat3&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 want1 as&lt;/P&gt;&lt;P&gt;select distinct prescriptions&lt;/P&gt;&lt;P&gt;from have&lt;/P&gt;&lt;P&gt;where missing(indications);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table count as&lt;/P&gt;&lt;P&gt;select distinct count(prescriptions) as count&lt;/P&gt;&lt;P&gt;from have&lt;/P&gt;&lt;P&gt;where missing(indications);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want2 as&lt;/P&gt;&lt;P&gt;select distinct prescriptions,indications&lt;/P&gt;&lt;P&gt;from have&lt;/P&gt;&lt;P&gt;where not missing(indications);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202086#M1812</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-06-10T12:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct values when missing fields/Notmissing fields</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202087#M1813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ya, this is exactly what I wanted. But, how to achieve this in SASVA, as there is no "Where/When" condition in aggregated measure.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Or is it possible to write this code in SASVA to create temp tables?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Ajay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202087#M1813</guid>
      <dc:creator>vasireddyajay</dc:creator>
      <dc:date>2015-06-10T12:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct values when missing fields/Notmissing fields</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202088#M1814</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;You give no indication of what you want your output to look like, so here are two examples:&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; prescriptions="Press1"; Indications="Indicat1"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; prescriptions="Press2"; Indications=""; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; prescriptions="Press3"; Indications=""; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; prescriptions="Press4"; Indications="Indicat2"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; prescriptions="Press5"; Indications="Indicat3"; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table WANT as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp; count(distinct A.PRESCRIPTIONS) as DIST_P_MISS,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count(distinct B.PRESCRIPTIONS) as DIST_P_NON&lt;/P&gt;&lt;P&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; (select * from HAVE where INDICATIONS is null) A&lt;/P&gt;&lt;P&gt;&amp;nbsp; full join&amp;nbsp; (select * from HAVE where INDICATIONS is not null) B&lt;/P&gt;&lt;P&gt;&amp;nbsp; on&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1=1;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table WANT2 as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp; "Distinct Prescriptions with Missing Indication" as COL1 length=200,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count(distinct PRESCRIPTIONS) as RESULT&lt;/P&gt;&lt;P&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; HAVE&lt;/P&gt;&lt;P&gt;&amp;nbsp; where&amp;nbsp;&amp;nbsp; INDICATIONS is null&lt;/P&gt;&lt;P&gt;&amp;nbsp; union all&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp; "Distinct Prescriptions with Indication", &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count(distinct PRESCRIPTIONS)&lt;/P&gt;&lt;P&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; HAVE &lt;/P&gt;&lt;P&gt;&amp;nbsp; where INDICATIONS is not null;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202088#M1814</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-06-10T12:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct values when missing fields/Notmissing fields</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202089#M1815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ajay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if you’ve considered using the data builder in SASVA, but it sounds like it could be a good option for what you need to accomplish. From the data builder, you can create data queries and filter using the ‘Where’ tab. You can find more information here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/vaug/68027/HTML/default/viewer.htm#p0ef9qegein6kon1dy9qm4szawnp.htm"&gt;http://support.sas.com/documentation/cdl/en/vaug/68027/HTML/default/viewer.htm#p0ef9qegein6kon1dy9qm4szawnp.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you prefer, you can also modify the code directly on the ‘Code’ tab in the data query. You can find more information here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/vaug/68027/HTML/default/viewer.htm#p1bhe7s7u4l7egn1d2ahwvqw34is.htm"&gt;http://support.sas.com/documentation/cdl/en/vaug/68027/HTML/default/viewer.htm#p1bhe7s7u4l7egn1d2ahwvqw34is.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;(If you use this method, be sure to save the data query at least once before you unlock the code)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need more information, please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Lorrie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 13:43:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/202089#M1815</guid>
      <dc:creator>Lorrie_SAS</dc:creator>
      <dc:date>2015-06-10T13:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct values when missing fields/Notmissing fields</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/355584#M7092</link>
      <description>&lt;P&gt;the easiest way is to make a calculated item and working with IF then else case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF ( 'column'n Missing )&lt;BR /&gt;RETURN 1&lt;BR /&gt;ELSE 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this will flag all your missing columns. The sum will tell you how many cells are missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can use the&amp;nbsp;NotMissing to count the number of filled cells/rows.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 13:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Count-distinct-values-when-missing-fields-Notmissing-fields/m-p/355584#M7092</guid>
      <dc:creator>mojerry_realdolmen</dc:creator>
      <dc:date>2017-05-03T13:40:22Z</dc:date>
    </item>
  </channel>
</rss>

