<?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: how to read year from a date variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143831#M38255</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Reeza on the character.&amp;nbsp; If its a date then you would normally have some kind of delimiter between day/month/year.&amp;nbsp; Easier to check that:&lt;/P&gt;&lt;P&gt;for date_variable="01/JAN/2000"&lt;/P&gt;&lt;P&gt;Year=scan(date_variable,3,"/");&lt;/P&gt;&lt;P&gt;Should set year="2000" as its the third part.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jan 2015 13:25:02 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-01-29T13:25:02Z</dc:date>
    <item>
      <title>how to read year from a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143828#M38252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;i have the dataset with variables id name joining date and salary&lt;/P&gt;&lt;P&gt;the birthdate is in the format date9. &lt;/P&gt;&lt;P&gt;now i have to read birthday only year i am trying with substr function but not getting the result.&lt;/P&gt;&lt;P&gt;can some one help me.&lt;/P&gt;&lt;P&gt;i tried as &lt;/P&gt;&lt;P&gt;x=substr("join_date"d, length("join_date"d)-3,4);&lt;/P&gt;&lt;P&gt;Is it correct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 09:29:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143828#M38252</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-01-29T09:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to read year from a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143829#M38253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just use the year() function. If you need it as character, wrap it into put(year(join_date),4.);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 11:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143829#M38253</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-01-29T11:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to read year from a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143830#M38254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is your join date variable a character or number/sas date. If its a number then Kurts solution is correct. If its a char yours is close but need to remove quotes and d from around join_date variable. Its not a good method because what if the date is shorter in some circumstances though. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 12:05:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143830#M38254</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-29T12:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to read year from a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143831#M38255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Reeza on the character.&amp;nbsp; If its a date then you would normally have some kind of delimiter between day/month/year.&amp;nbsp; Easier to check that:&lt;/P&gt;&lt;P&gt;for date_variable="01/JAN/2000"&lt;/P&gt;&lt;P&gt;Year=scan(date_variable,3,"/");&lt;/P&gt;&lt;P&gt;Should set year="2000" as its the third part.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 13:25:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143831#M38255</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-29T13:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to read year from a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143832#M38256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, I'm moving this from the "about Communities on SAS" space to the SAS Procedures space just so that these answers are visible to others in that area. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 14:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-read-year-from-a-date-variable/m-p/143832#M38256</guid>
      <dc:creator>Community_Help</dc:creator>
      <dc:date>2015-01-29T14:44:39Z</dc:date>
    </item>
  </channel>
</rss>

