<?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: format or function for year in All Things Community</title>
    <link>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351640#M2381</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I am vry sorry, i have forgot to mention this , I dont want any value to be hardcoded (date='2000'). I am trying to automate the program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 20 Apr 2017 12:28:14 GMT</pubDate>
    <dc:creator>navyaroopa</dc:creator>
    <dc:date>2017-04-20T12:28:14Z</dc:date>
    <item>
      <title>format or function for year</title>
      <link>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351627#M2378</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted a format for displaying year when a variable year is in 2 digits and options yearcutoff is used:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have done a programing like below mentioned:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data v;&lt;BR /&gt;input v $4.;&lt;BR /&gt;datalines;&lt;BR /&gt;17&lt;BR /&gt;20&lt;BR /&gt;14&lt;BR /&gt;1&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;option yearcutoff=2000;&lt;BR /&gt;data v1(drop=catv);&lt;BR /&gt;set v;&lt;BR /&gt;if length(v)=2 then do;&lt;BR /&gt;catv= input("01/01/"||strip(v),ddmmyy8.);&lt;BR /&gt;date=year(catv);&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont want this big code. Is there any format where i can use and can get my year value in 4 digits. Could someone help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks&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;</description>
      <pubDate>Thu, 20 Apr 2017 11:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351627#M2378</guid>
      <dc:creator>navyaroopa</dc:creator>
      <dc:date>2017-04-20T11:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: format or function for year</title>
      <link>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351634#M2379</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date = '2000';
substr(date,4-length(strip(v))+1) = strip(v);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Apr 2017 12:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351634#M2379</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-20T12:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: format or function for year</title>
      <link>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351636#M2380</link>
      <description>&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data v;
input v $4.;
date = '2000';
substr(date,4-length(strip(v))+1) = strip(v);
datalines;
17
20
14
1
;
run;

proc print data=v noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;v     date

17    2017
20    2020
14    2014
1     2001
&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Apr 2017 12:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351636#M2380</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-20T12:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: format or function for year</title>
      <link>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351640#M2381</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I am vry sorry, i have forgot to mention this , I dont want any value to be hardcoded (date='2000'). I am trying to automate the program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 12:28:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351640#M2381</guid>
      <dc:creator>navyaroopa</dc:creator>
      <dc:date>2017-04-20T12:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: format or function for year</title>
      <link>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351652#M2382</link>
      <description>&lt;P&gt;Sorry, how are you planning on automating a process without all the required information? &amp;nbsp;A year is a four digit number YYYY, if you only have two digits YY, then you will need somehow to specify to the program what the default other two numbers are, is 17 = 1917, 1817, 1717, or 2017? &amp;nbsp;That is information&amp;nbsp;&lt;STRONG&gt;you&lt;/STRONG&gt; have to provide as there is now other logical way of knowing what&amp;nbsp;&lt;STRONG&gt;you&lt;/STRONG&gt; think those two should be.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 12:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351652#M2382</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-20T12:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: format or function for year</title>
      <link>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351659#M2383</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/111849"&gt;@navyaroopa&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am vry sorry, i have forgot to mention this , I dont want any value to be hardcoded (date='2000'). I am trying to automate the program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You hardcoded your year with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option yearcutoff=2000;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in your initial post. What needs to be automated?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 13:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351659#M2383</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-20T13:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: format or function for year</title>
      <link>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351668#M2384</link>
      <description>&lt;P&gt;So if you know that your YR2 variable is between 0 and 99 then you can just use something like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;yr4 = year(input(put(yr2,z2.)||'0101',yymmdd6.));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or were you looking to find an algorithm to implement the year cut off functionality yourself with using any informats?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yearcutoff=%sysfunc(getoption(yearcutoff));
data want ;
  input yr2 @@ ;
  yr4 = 100*((yr2&amp;lt;mod(&amp;amp;yearcutoff,100))+int(&amp;amp;yearcutoff/100))+yr2;
  yr4_date = year(input(put(yr2,z2.)||'0101',yymmdd6.));
  put (_all_) (=);
cards;
1 20 25 26 27 30
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 14:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/All-Things-Community/format-or-function-for-year/m-p/351668#M2384</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-04-20T14:04:13Z</dc:date>
    </item>
  </channel>
</rss>

