<?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: issue with if statment in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909229#M17699</link>
    <description>&lt;P&gt;There is no code in the common sense. The Word document contains an edited screenshot from SAS VA. Let's hope that another point-and-click user can chime in here.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Dec 2023 08:53:48 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-12-21T08:53:48Z</dc:date>
    <item>
      <title>issue with if statment</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909225#M17697</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I have an issue with if statement, Which is &lt;FONT color="#FF0000"&gt;adding extra one value&lt;/FONT&gt; extra on my calculation item, my case :&lt;/P&gt;&lt;P&gt;I have lists of students and it's categorize (failed ,success ,second exam..etc.).&lt;/P&gt;&lt;P&gt;total number of success students (540).&lt;/P&gt;&lt;P&gt;but when i Try to get this number(number of success student) using calculated item it got (541), Which is &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;incorrect:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check the attached file from sas visual anayltic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,Any Idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 08:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909225#M17697</guid>
      <dc:creator>H_K</dc:creator>
      <dc:date>2023-12-21T08:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: issue with if statment</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909227#M17698</link>
      <description>&lt;P&gt;Please insert any code and sample data directly in the post, using the "SAS Submit" icon.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 08:44:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909227#M17698</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-12-21T08:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: issue with if statment</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909229#M17699</link>
      <description>&lt;P&gt;There is no code in the common sense. The Word document contains an edited screenshot from SAS VA. Let's hope that another point-and-click user can chime in here.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 08:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909229#M17699</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-12-21T08:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: issue with if statment</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909233#M17700</link>
      <description>&lt;P&gt;/**************************Calculated Item to Return Number of success students *****************************/&lt;/P&gt;&lt;P&gt;Distinct [_ByGroup_] ((&lt;BR /&gt;IF ( 'Academic_Student_Status'n In ('Pass', 'Pass_after_SecondExam') )&lt;BR /&gt;RETURN 'PC_ADM_PRS_ID'n[Formatted]&lt;BR /&gt;ELSE 0 ))&lt;/P&gt;&lt;P&gt;/*******************************************************/&lt;/P&gt;&lt;P&gt;This calculated Item return 541 of students which is wrong, The actual value 540&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 09:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909233#M17700</guid>
      <dc:creator>H_K</dc:creator>
      <dc:date>2023-12-21T09:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: issue with if statment</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909261#M17701</link>
      <description>&lt;P&gt;I think maybe the calculation is a bit flawed here. I assume there are instances where&amp;nbsp;&lt;SPAN&gt;Academic_Student_Status'n = 'Fail' so in addition to PC_ADM_PRS_ID values, you are getting 0 returned for that calculation, and that is getting included in the Distinct count. In other words you are getting a 540 values for PC_ADM_PRS_ID, and then 0, for a total of 541 distinct values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;If you are just using this in a single Key Value object, what I think you should probably do instead is just create a single calculated item for the Distinct Count of PC_ADM_PRS_ID:&lt;BR /&gt;&lt;BR /&gt;Distinct [_ByGroup_] ('PC_ADM_PRS_ID'n[Formatted])&lt;BR /&gt;&lt;BR /&gt;Add that to the Key Value object, and then add a local filter on the Key Value object for Academic_Student_Status'n In ('Pass','Pass_after_SecondExam'). Meaning - click the Key Value object, click the Filters pane on the right hand side, add this filter.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise if you already doing some kind of filtering that I'm not seeing - another possibility is if there happens to be a missing value somewhere in the PC_ADM_PRS_ID data item, then Distinct by default includes this in the count.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If that's the case, you might you might be able to account for this in your calculation by adding a second IF statement to check for missing. Something like this (note this is not exact, just freehand typing into this to illustrate the point):&lt;BR /&gt;&lt;SPAN&gt;Distinct [_ByGroup_] ((&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IF ( 'Academic_Student_Status'n In ('Pass', 'Pass_after_SecondExam') )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RETURN (IF ('PC_ADM_PRS_ID'n[Formatted] NotMissing)&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RETURN&amp;nbsp;&lt;SPAN&gt;'PC_ADM_PRS_ID'n[Formatted]&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ELSE 0))&lt;BR /&gt;&lt;SPAN&gt;ELSE 0 ))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Not sure which VA version you have but there is a property to control this that you or your Administrator can set, and here are the steps for Viya 3.5:&lt;BR /&gt;1. Log in to SAS Environment Manager as an Administrator&lt;/P&gt;
&lt;P&gt;2. Go to Configuration &amp;gt; All Services &amp;gt; Report Data service&lt;/P&gt;
&lt;P&gt;3. Edit the "sas.reportdata.properties" section, and find the property "ignoreMissingValuesInCountDistinct".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Turn this one on, save changes, and restart the Report Data service.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For Viya 4 the steps are very similar. For SAS 9.4 this property is in SAS Management Console in the Application Management &amp;gt; SAS Application Infrastructure &amp;gt; Visual Analytics 7.5 properties, and requires a restart of SASServer12_1.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 13:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/issue-with-if-statment/m-p/909261#M17701</guid>
      <dc:creator>HunterT_SAS</dc:creator>
      <dc:date>2023-12-21T13:21:40Z</dc:date>
    </item>
  </channel>
</rss>

