<?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 isolate Month, Day, or Year from a Date? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394426#M95041</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;, Good Catch &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Sep 2017 09:04:25 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2017-09-09T09:04:25Z</dc:date>
    <item>
      <title>How do you isolate Month, Day, or Year from a Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394358#M95010</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a second data set which finds when the day of the VisitD variable&amp;nbsp; is a monday or the year of the VisitD variable is 2002. I am using the Set function. I am learning from SAS by Example and the answers are not in the book. Could someone offer some assistance? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the original dat set from which I want to find which dates fall on a Monday or are in the year 2002, using SAS code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Libname SASdata '/folders/myfolders/SASData' ;&lt;BR /&gt;Data SasData.HealthHosp ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Input PatID 3.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; DOB&amp;nbsp;&amp;nbsp; mmddyy10.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; VisitD mmddyy10. ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;format DOB &lt;STRONG&gt;VisitD&lt;/STRONG&gt; mmddyy10. ;&lt;BR /&gt;Datalines ;&lt;BR /&gt;00112/25/19445/17/2000&lt;BR /&gt;00205/11/19668/4/2002&lt;BR /&gt;00308/03/20009/2/2003&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 21:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394358#M95010</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2017-09-08T21:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do you isolate Month, Day, or Year from a Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394360#M95012</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data HealthHosp ;
    Input PatID 3.
          DOB   mmddyy10.
          VisitD mmddyy10. ;
    format DOB VisitD mmddyy10. ;
Datalines ;
00112/25/19445/17/2000
00205/11/19668/4/2002
00308/03/20009/2/2003
;

data want;
   set HealthHosp;
   where weekday(VisitD)=2 | year(VisitD)=2002;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Sep 2017 09:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394360#M95012</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-09-09T09:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do you isolate Month, Day, or Year from a Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394361#M95013</link>
      <description>&lt;P&gt;data want;&lt;BR /&gt;set HealthHosp;&lt;BR /&gt;where strip(put(weekday(VisitD),weekdate9.))="Monday" or year(visitd)=2002;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 21:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394361#M95013</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-08T21:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do you isolate Month, Day, or Year from a Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394364#M95014</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;YEAR/MONTH/DAY functions.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 21:47:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394364#M95014</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-08T21:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do you isolate Month, Day, or Year from a Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394366#M95015</link>
      <description>&lt;P&gt;Grat, thanks. One quick follow up: I thought for the Weekday function Sunday = 1 and Monday = 2? That is what the book says, but maybe that has changed since?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 22:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394366#M95015</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2017-09-08T22:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you isolate Month, Day, or Year from a Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394368#M95017</link>
      <description>&lt;P&gt;Good set of tools, but notice ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For Monday, the WEEKDAY function should return 2 not 1. &amp;nbsp;Also note, if you are reading from the raw data, you can build in efficiency (not a consideration when you have only a few lines of raw data):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;Data&lt;/SPAN&gt; want &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="token keyword"&gt;Input&lt;/SPAN&gt; @ 14 VisitD mmddyy10. @ ;&lt;BR /&gt;    if weekday(VisitD) = 2 or year(VisitD) = 2002;&lt;BR /&gt;    Input @ 1 PatID &lt;SPAN class="token number"&gt;3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;
          DOB   mmddyy10&lt;SPAN class="token punctuation"&gt;. &lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; DOB VisitD mmddyy10&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
Datalines &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token number"&gt;00112&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;25&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;19445&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;17&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2000&lt;/SPAN&gt;
&lt;SPAN class="token number"&gt;00205&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;11&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;19668&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;4&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2002&lt;/SPAN&gt;
&lt;SPAN class="token number"&gt;00308&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;03&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;20009&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2003&lt;/SPAN&gt;
&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 22:15:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394368#M95017</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-09-08T22:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do you isolate Month, Day, or Year from a Date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394426#M95041</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;, Good Catch &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Sep 2017 09:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-isolate-Month-Day-or-Year-from-a-Date/m-p/394426#M95041</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-09-09T09:04:25Z</dc:date>
    </item>
  </channel>
</rss>

