<?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 Can't solve missing value error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306473#M65524</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if anyone could help me find a solution to this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I'm trying to execute in SAS 9.3:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table BE (drop=CUSIP PRC shrout) as&lt;BR /&gt;select a.*, b.*, b.me as size&lt;BR /&gt;from comp1 as a&lt;BR /&gt;LEFT JOIN msex2(drop=RET)as b&lt;BR /&gt;on a.cusip=b.cusip&lt;BR /&gt;where (a.fyear+1)=year(b.date)and month(b.date) = 6;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And when I run it, I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Invalid (or missing) arguments to the YEAR function have caused the&lt;BR /&gt;function to return a missing value.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;NOTE: Invalid (or missing) arguments to the MONTH&amp;nbsp;function have caused the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;function to return a missing value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've checked the table, I did the summary listing all the available dates and also checked for the missing values. The DATE field in the table has no missing or invalid values.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I just can't figure out, why it's giving my this error,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advance for anyone's input!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Oct 2016 22:51:10 GMT</pubDate>
    <dc:creator>valeriya</dc:creator>
    <dc:date>2016-10-21T22:51:10Z</dc:date>
    <item>
      <title>Can't solve missing value error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306473#M65524</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if anyone could help me find a solution to this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I'm trying to execute in SAS 9.3:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table BE (drop=CUSIP PRC shrout) as&lt;BR /&gt;select a.*, b.*, b.me as size&lt;BR /&gt;from comp1 as a&lt;BR /&gt;LEFT JOIN msex2(drop=RET)as b&lt;BR /&gt;on a.cusip=b.cusip&lt;BR /&gt;where (a.fyear+1)=year(b.date)and month(b.date) = 6;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And when I run it, I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Invalid (or missing) arguments to the YEAR function have caused the&lt;BR /&gt;function to return a missing value.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;NOTE: Invalid (or missing) arguments to the MONTH&amp;nbsp;function have caused the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;function to return a missing value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've checked the table, I did the summary listing all the available dates and also checked for the missing values. The DATE field in the table has no missing or invalid values.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I just can't figure out, why it's giving my this error,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advance for anyone's input!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 22:51:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306473#M65524</guid>
      <dc:creator>valeriya</dc:creator>
      <dc:date>2016-10-21T22:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can't solve missing value error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306481#M65529</link>
      <description>&lt;P&gt;That's a toughie!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All I can think of is to run these two queries (syntax unchecked).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select min(date) as mindate, max(date) as maxdate from msex2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These shoud be roughly between the range of -137727 and 6552447. If they are wildly out of that range, they are probably datetime variables or erroneous data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the other, which I think you've already run, is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select count(*) from msex2 where date is missing;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Tom&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2016 01:01:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306481#M65529</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2016-10-22T01:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can't solve missing value error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306483#M65531</link>
      <description>&lt;P&gt;What variable type is date? And what format?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2016 01:33:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306483#M65531</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-22T01:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can't solve missing value error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306489#M65532</link>
      <description>&lt;P&gt;It is because you are doing a LEFT JOIN and so some of the results from the join that are passed to the WHERE clause might not have had any contribution from the right had table. &amp;nbsp;Therefore the value of the DATE variable will be missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not just add the condition to the ON clause?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table BE (drop=CUSIP PRC shrout) as
    select a.*, b.*, b.me as size
    from comp1 as a
    LEFT JOIN msex2(drop=RET)as b
    on a.cusip=b.cusip
    and (a.fyear+1)=year(b.date)and month(b.date) = 6
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Oct 2016 01:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306489#M65532</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-10-22T01:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can't solve missing value error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306794#M65642</link>
      <description>Variable Date is in the date format. I checked that table separately and it's extracting month and a date without a problem. It is only problematic when I add the left join.</description>
      <pubDate>Mon, 24 Oct 2016 14:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306794#M65642</guid>
      <dc:creator>valeriya</dc:creator>
      <dc:date>2016-10-24T14:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can't solve missing value error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306796#M65644</link>
      <description>Thank you very much for your reply. I really was suspecting there is an issue with a Left Join, I just didn't know why it's an issue. I haven't had time to check your solution, but I will do that and will let you know.&lt;BR /&gt;&lt;BR /&gt;Thanks a lot!</description>
      <pubDate>Mon, 24 Oct 2016 14:07:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306796#M65644</guid>
      <dc:creator>valeriya</dc:creator>
      <dc:date>2016-10-24T14:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can't solve missing value error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306797#M65645</link>
      <description>Thank you for your reply! I didn't get a chance to try the things you listed, but I will do so.</description>
      <pubDate>Mon, 24 Oct 2016 14:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-solve-missing-value-error/m-p/306797#M65645</guid>
      <dc:creator>valeriya</dc:creator>
      <dc:date>2016-10-24T14:08:11Z</dc:date>
    </item>
  </channel>
</rss>

