<?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 do you extract or subset observations for a specific year  from variable date time from a data set ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164665#M263647</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is not working? Post your code and log.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Aug 2014 03:30:25 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2014-08-18T03:30:25Z</dc:date>
    <item>
      <title>How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164655#M263637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do you extract or subset observations for a specific year&amp;nbsp; from variable date time from a data set ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Aug 2014 23:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164655#M263637</guid>
      <dc:creator>momin</dc:creator>
      <dc:date>2014-08-17T23:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164656#M263638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;BR /&gt;input date anydtdtm.;&lt;BR /&gt;format date datetime20.;&lt;BR /&gt;cards;&lt;BR /&gt;28-05-2013:11:21:20&lt;BR /&gt;27-05-2013:15:22:26&lt;BR /&gt;27-05-2013:11:36:33&lt;BR /&gt;27-05-2013:11:14:55&lt;BR /&gt;28-05-2014:10:21:20&lt;BR /&gt;27-05-2014:14:22:26&lt;BR /&gt;27-05-2014:11:36:33&lt;BR /&gt;27-05-2014:17:14:55&lt;BR /&gt;27-05-2014:10:34:56&lt;BR /&gt;27-05-2014:19:03:48&lt;BR /&gt;27-05-2014:14:30:56&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;if year(datepart(date))=2013;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=want;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Aug 2014 23:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164656#M263638</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-08-17T23:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164657#M263639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have SAS 9.2 or newer you can use the DTEXTYEAR() function.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DT for Date Time&lt;/P&gt;&lt;P&gt;EXT for Extract&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are also DAY , MONTH, and WEEKDAY versions.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 00:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164657#M263639</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-08-18T00:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164658#M263640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can find DTEXTYEAR() as a supported function by Access engines - but I can't find the function as such documented under "functions"&amp;nbsp; &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/67398/HTML/default/viewer.htm#titlepage.htm" title="http://support.sas.com/documentation/cdl/en/lefunctionsref/67398/HTML/default/viewer.htm#titlepage.htm"&gt;SAS(R) 9.4 Functions and CALL Routines: Reference, Third Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know where I could find the documentation and why this one is not documented where one would expect it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 00:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164658#M263640</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-08-18T00:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164659#M263641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Data A;&lt;/P&gt;&lt;P&gt;set Shareef.emp;&lt;/P&gt;&lt;P&gt;if year(datepart(date))=1982;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;This is not working.returns zero observations. I know for sure that there is year 1982 in the following format&amp;nbsp; 23jan198200.00.00 and the name of the variable is hiredate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 01:38:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164659#M263641</guid>
      <dc:creator>momin</dc:creator>
      <dc:date>2014-08-18T01:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164660#M263642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't know. It is in the view SASHELP.VFUNC. Not sure if it requires SAS/Access to be licensed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 01:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164660#M263642</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-08-18T01:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164661#M263643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;Is that the way to do it?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Mohammed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data B;&lt;/P&gt;&lt;P&gt;set Shareef.emp;&lt;/P&gt;&lt;P&gt;dtextyear(1982);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 01:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164661#M263643</guid>
      <dc:creator>momin</dc:creator>
      <dc:date>2014-08-18T01:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164662#M263644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To subset data you need to use a WHERE statement ( or possibly an IF statement).&amp;nbsp; A WHERE statement requires an expression that can be evaluated to be true or false.&amp;nbsp; So if the variable in your dataset that has date time values is named DT then you might do something like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; year(datepart(DT)) = &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1982&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;Or you could use other forms:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dtextyear(DT) = &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1982&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;where&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;'01JAN1982:00:00'dt&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;lt;= DT &amp;lt; &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;'01JAN1983:00:00'dt&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 02:36:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164662#M263644</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-08-18T02:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164663#M263645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SORRY, BOTH WAYS DON'T WORK.&lt;/P&gt;&lt;P&gt;THANKS ANYWAYS&lt;/P&gt;&lt;P&gt;MOHAMMED&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 02:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164663#M263645</guid>
      <dc:creator>momin</dc:creator>
      <dc:date>2014-08-18T02:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164664#M263646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will not work unless you replace date with hiredate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data A;&lt;/P&gt;&lt;P&gt;set Shareef.emp;&lt;/P&gt;&lt;P&gt;if year(datepart(&lt;STRONG&gt;hiredate&lt;/STRONG&gt;))=1982;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 03:08:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164664#M263646</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-08-18T03:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164665#M263647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is not working? Post your code and log.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 03:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164665#M263647</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-08-18T03:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164666#M263648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No,doesn't work!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 03:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164666#M263648</guid>
      <dc:creator>momin</dc:creator>
      <dc:date>2014-08-18T03:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164667#M263649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post your SAS code and the SAS log which shows us what exactly is not working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 06:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164667#M263649</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-08-18T06:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164668#M263650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you sure that HIREDATE is not a string instead of a proper datetime value?&lt;/P&gt;&lt;P&gt;Or perhaps it has already been converted from datetime to date. If so then just use the YEAR() function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 17:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164668#M263650</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-08-18T17:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract or subset observations for a specific year  from variable date time from a data set ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164669#M263651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;tried again.it worked.Thanks for everyone's help.Regards&lt;/P&gt;&lt;P&gt;Mohammed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 17:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-extract-or-subset-observations-for-a-specific-year/m-p/164669#M263651</guid>
      <dc:creator>momin</dc:creator>
      <dc:date>2014-08-18T17:07:00Z</dc:date>
    </item>
  </channel>
</rss>

