<?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 How to - Prevent &amp;quot;No valid observations are found&amp;quot; in PROC REG Procedure? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Prevent-quot-No-valid-observations-are-found-quot-in-PROC/m-p/497302#M72457</link>
    <description>&lt;P&gt;As you know, Proc Reg gives errors when whole values are missing. I have a character type variable, I want to prevent the error "&lt;SPAN&gt;No valid observations are found". I know it is related to data but I want to prevent it without fix the data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried following Where statement but it sitill gives same error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REG DATA=sampleData(Where=(charVariable not is missing)) PLOTS(ONLY)=ALL;
By charVariable ;
......
.....
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Sep 2018 10:44:29 GMT</pubDate>
    <dc:creator>ertr</dc:creator>
    <dc:date>2018-09-20T10:44:29Z</dc:date>
    <item>
      <title>How to - Prevent "No valid observations are found" in PROC REG Procedure?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Prevent-quot-No-valid-observations-are-found-quot-in-PROC/m-p/497302#M72457</link>
      <description>&lt;P&gt;As you know, Proc Reg gives errors when whole values are missing. I have a character type variable, I want to prevent the error "&lt;SPAN&gt;No valid observations are found". I know it is related to data but I want to prevent it without fix the data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried following Where statement but it sitill gives same error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REG DATA=sampleData(Where=(charVariable not is missing)) PLOTS(ONLY)=ALL;
By charVariable ;
......
.....
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 10:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Prevent-quot-No-valid-observations-are-found-quot-in-PROC/m-p/497302#M72457</guid>
      <dc:creator>ertr</dc:creator>
      <dc:date>2018-09-20T10:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Prevent "No valid observations are found" in PROC REG Procedure?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Prevent-quot-No-valid-observations-are-found-quot-in-PROC/m-p/497305#M72458</link>
      <description>&lt;P&gt;Well, your where clause looks wrong:&lt;/P&gt;
&lt;PRE&gt;proc reg data=sampledata plots(only)=all;
  by charVariable;
  where charvariable ne "";
run;&lt;/PRE&gt;
&lt;P&gt;Note I moved it into the body of the proc for clarity.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 11:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Prevent-quot-No-valid-observations-are-found-quot-in-PROC/m-p/497305#M72458</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-20T11:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Prevent "No valid observations are found" in PROC REG Procedure?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Prevent-quot-No-valid-observations-are-found-quot-in-PROC/m-p/497376#M72463</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/90606"&gt;@ertr&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I take it that you want to exclude those BY groups from the analyses where all observations have at least one missing value in the response or regressor variables (which causes the error message "No valid observations are found.").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You haven't shown your MODEL statement, so let's look at a generic example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;model y=x1 x2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Let SAS find out which BY groups are to be excluded:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let _excl='dummyvalue';

proc sql noprint;
select quote(trim(charVariable))
into :_excl separated by ' '
from sampleData
group by charVariable
having min(nmiss(y, x1, x2));
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This PROC SQL step creates a list of the quoted values of charVariable to be excluded* and writes this list into macro variable _EXCL -- unless no values need to be excluded, in which case the initial value 'dummyvalue' remains in _EXCL. So, &amp;amp;_EXCL will never resolve to a null string and is valid in a WHERE condition like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc reg data=sampleData(where=(charVariable not in (&amp;amp;_excl)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course it is assumed that 'dummyvalue' is not among the values of charVariable for which you want to perform an analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To adapt the above code to your needs, please replace "y" by the name of your&amp;nbsp;&lt;SPAN&gt;response&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;variable and&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;"x1, x2" by the list of your regressor variable(s).&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;*For each observation in a BY group it&amp;nbsp;determines the number of missing values among response (y) and regressor variables (x1, x2) and if the minimum of all these numbers within a BY group is not zero (hence &amp;gt;=1, i.e., all observations of the BY group have at least one missing value), the BY value is appended to the list in _EXCL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: Your existing WHERE condition may look odd, but it's syntactically correct.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 14:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Prevent-quot-No-valid-observations-are-found-quot-in-PROC/m-p/497376#M72463</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-09-20T14:20:16Z</dc:date>
    </item>
  </channel>
</rss>

