<?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: difference in year in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806565#M317811</link>
    <description>&lt;P&gt;We need to see the &lt;FONT color="#FF0000"&gt;ENTIRE&lt;/FONT&gt; log for this SAS data step. In other words, the code and all NOTES, WARNINGs and ERRORs, as they appear in the log. We don't know what the log is reacting to because without that other information, we don't know what line 146 is.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Apr 2022 16:20:55 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-04-07T16:20:55Z</dc:date>
    <item>
      <title>difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806547#M317796</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to make the difference between date in year ( date format is&amp;nbsp;mmddyy10.)&lt;/P&gt;
&lt;P&gt;I write this program but it does not work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data ageyear;
 set inception;
Age = yrdif(Inception_date, sas_date, 'AGEYear');
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 15:38:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806547#M317796</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2022-04-07T15:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806548#M317797</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I write this program but it does not work&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It is never sufficient to say "it does not work" and stop there. If there are errors in the log, SHOW US the log. If the output is incorrect, SHOW US the incorrect output and explain why it is incorrect. Please provide that information.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 15:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806548#M317797</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-07T15:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806555#M317802</link>
      <description>&lt;P&gt;Doesn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the "&amp;lt;/&amp;gt;" to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "&amp;lt;/&amp;gt;" icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4327"&gt;@sasphd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to make the difference between date in year ( date format is&amp;nbsp;mmddyy10.)&lt;/P&gt;
&lt;P&gt;I write this program but it does not work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data ageyear;
 set inception;
Age = yrdif(Inception_date, sas_date, 'AGEYear');
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 15:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806555#M317802</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-07T15:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806563#M317810</link>
      <description>&lt;P&gt;this is the log error&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
NOTE: Invalid argument to function YRDIF(9646,9677,'AGEYear') at line 146 column 7.
secid=F000000EU6 DATE=198606 mret=0.006 sas_date=06/30/1986 Inception_date=05/30/1986 Age=.
_ERROR_=1 _N_=1
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sasphd_0-1649348184322.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70193i1EB2BDE9C28AD0C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sasphd_0-1649348184322.png" alt="sasphd_0-1649348184322.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;this is the output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 16:17:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806563#M317810</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2022-04-07T16:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806565#M317811</link>
      <description>&lt;P&gt;We need to see the &lt;FONT color="#FF0000"&gt;ENTIRE&lt;/FONT&gt; log for this SAS data step. In other words, the code and all NOTES, WARNINGs and ERRORs, as they appear in the log. We don't know what the log is reacting to because without that other information, we don't know what line 146 is.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 16:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806565#M317811</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-07T16:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806572#M317817</link>
      <description>&lt;P&gt;Code from the log as well as the error message. There is something else going on because those numeric values are not the issue. Actual data in the form of a data step such as the following that generates the &lt;STRONG&gt;same error &lt;/STRONG&gt;when using the same code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   input sas_date :mmddyy10. Inception_date :mmddyy10.;
   format sas_date inception_date mmddyy10.;
datalines;
06/30/1986 05/30/1986
;
&lt;/PRE&gt;
&lt;P&gt;It is possible that if you copied the line of code with the AGE= yrdif( ) from the internet or some document with formatting like a word processor file that there are invisible formatting characters you don't see that can cause errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 16:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806572#M317817</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-07T16:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806573#M317818</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4327"&gt;@sasphd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to make the difference between date in year ( date format is&amp;nbsp;mmddyy10.)&lt;/P&gt;
&lt;P&gt;I write this program but it does not work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data ageyear;
 set inception;
Age = yrdif(Inception_date, sas_date, 'AGEYear');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;AGEYear is not a valid BASIS.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 16:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806573#M317818</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2022-04-07T16:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806574#M317819</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4327"&gt;@sasphd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to make the difference between date in year ( date format is&amp;nbsp;mmddyy10.)&lt;/P&gt;
&lt;P&gt;I write this program but it does not work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data ageyear;
 set inception;
Age = yrdif(Inception_date, sas_date, 'AGEYear');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;AGEYear is not a valid BASIS.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But, at least in my install, does not throw an error:&lt;/P&gt;
&lt;PRE&gt;205  data example;
206     input sas_date :mmddyy10. Inception_date :mmddyy10.;
207     format sas_date inception_date mmddyy10.;
208     Age = yrdif(Inception_date, sas_date, 'AGEYear');
209
210  datalines;

NOTE: The data set WORK.EXAMPLE has 1 observations and 3 variables.
&lt;/PRE&gt;
&lt;P&gt;Either the code ignore the "year" part of "AGEyear" and accepts AGE, or ignores the entire argument and uses the default, which is AGE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4327"&gt;@sasphd&lt;/a&gt; which version of SAS are your running?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 17:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806574#M317819</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-07T17:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806576#M317821</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have find the problem. thanks for your help.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Age = yrdif(Inception_date, sas_date,'Actual');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 17:08:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806576#M317821</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2022-04-07T17:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806578#M317823</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4327"&gt;@sasphd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to make the difference between date in year ( date format is&amp;nbsp;mmddyy10.)&lt;/P&gt;
&lt;P&gt;I write this program but it does not work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data ageyear;
 set inception;
Age = yrdif(Inception_date, sas_date, 'AGEYear');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;AGEYear is not a valid BASIS.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Problem is, we DO know that the error occurs at line 146 column 7, and the 'AGEYear' is not column 7.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 17:10:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806578#M317823</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-07T17:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806579#M317824</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4327"&gt;@sasphd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have find the problem. thanks for your help.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Age = yrdif(Inception_date, sas_date,'Actual');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4327"&gt;@sasphd&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;
&lt;P&gt;Problem is the short piece of log you did show us said the error was at line 146, column 7, and changing to 'Actual' doesn't affect what is in column 7. So there was something else wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And again, I ask you to show us the ENTIRE log for this DATA step (and in the future, you need to show us the ENTIRE log without us even asking).&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 17:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806579#M317824</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-07T17:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: difference in year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806597#M317826</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the 7 referred to whatever position the YRDIF function Y appears and indicates that one of the parameters is wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interesting that in my install, SAS 9.4.4 I can place pure garbage in the BASIS option position and not generate any error. Though this version does not return the same value that the AGE does, instead matching the result for ACT. If I use AGExxxxx, where xxxx are just about any characters then apparently the AGE basis is used. Perhaps in this version SAS reads enough to see an option that matches an entry on the Basis list and stop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;277  data example;
278     input sas_date :mmddyy10. Inception_date :mmddyy10.;
279     format sas_date inception_date mmddyy10.;
280     Age = yrdif(Inception_date, sas_date,'gobbledegook');
281     put age= ;
282  datalines;

Age=0.0833333333
NOTE: The data set WORK.EXAMPLE has 1 observations and 3 variables.
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 17:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/difference-in-year/m-p/806597#M317826</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-07T17:35:00Z</dc:date>
    </item>
  </channel>
</rss>

