<?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 extract year and month from date in SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377456#M90638</link>
    <description>&lt;P&gt;just like this? but it didn't work.&lt;/P&gt;&lt;PRE&gt;ym=put(yymm,yymm6.);&lt;/PRE&gt;</description>
    <pubDate>Wed, 19 Jul 2017 16:54:15 GMT</pubDate>
    <dc:creator>lixuan</dc:creator>
    <dc:date>2017-07-19T16:54:15Z</dc:date>
    <item>
      <title>How to extract year and month from date in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377446#M90635</link>
      <description>&lt;P&gt;I have a variable in the form of yymmdd, and I want to extract yymm from it without changing the date format. I konw year() and month(),but I don't know how to get year and month in one variable. thanks a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 16:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377446#M90635</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-19T16:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract year and month from date in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377455#M90637</link>
      <description>&lt;P&gt;You can use the yymm format in a put statement.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 16:51:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377455#M90637</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-19T16:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract year and month from date in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377456#M90638</link>
      <description>&lt;P&gt;just like this? but it didn't work.&lt;/P&gt;&lt;PRE&gt;ym=put(yymm,yymm6.);&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jul 2017 16:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377456#M90638</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-19T16:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract year and month from date in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377458#M90640</link>
      <description>&lt;P&gt;sorry , i make a mistake. it has been resolved using the code. thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 16:56:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377458#M90640</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-19T16:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract year and month from date in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377472#M90643</link>
      <description>&lt;P&gt;but after &amp;nbsp;finished, it's &amp;nbsp;character &amp;nbsp;format instead of date format. my code :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
format dt yymmdd10.;
input dt yymmdd10.;
datalines;
2016-05-21
2017-08-12
2014-03-02
;
run;

data want;
set have;
yy = put(dt,yymmn6.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jul 2017 17:28:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377472#M90643</guid>
      <dc:creator>lixuan</dc:creator>
      <dc:date>2017-07-19T17:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract year and month from date in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377650#M90703</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132979"&gt;@lixuan&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;but after &amp;nbsp;finished, it's &amp;nbsp;character &amp;nbsp;format instead of date format. my code :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
format dt yymmdd10.;
input dt yymmdd10.;
datalines;
2016-05-21
2017-08-12
2014-03-02
;
run;

data want;
set have;
yy = put(dt,yymmn6.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A SAS data value defines a certain day. When you only have year and month, one usually uses a character variable for display, as a SAS data variable cannot be built without a day value.&lt;/P&gt;
&lt;P&gt;If you simply assign the yymm format to your original variable, it will display the way you want to. If you do want to create a new SAS date variable, you will have to set a rule for the day that it will use "internally", and then assign the yymm format to the new variable.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 06:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/377650#M90703</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-20T06:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract year and month from date in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/393471#M94758</link>
      <description>, I have input file having year ( let's say 2015 to 2017 YYYY) .&lt;BR /&gt;I am trying to fetch system year ( year(today())&lt;BR /&gt;And then compare year from input file to fetched year.&lt;BR /&gt;If matches , those rows should come in output.&lt;BR /&gt;&lt;BR /&gt;If comparison for years is not working ..Have tried reading input year in chat..Integer both..But nothing working.&lt;BR /&gt;Can some one please help..Urgent</description>
      <pubDate>Wed, 06 Sep 2017 09:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/393471#M94758</guid>
      <dc:creator>Singla14</dc:creator>
      <dc:date>2017-09-06T09:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract year and month from date in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/393643#M94822</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/163075"&gt;@Singla14&lt;/a&gt; wrote:&lt;BR /&gt;, I have input file having year ( let's say 2015 to 2017 YYYY) .&lt;BR /&gt;I am trying to fetch system year ( year(today())&lt;BR /&gt;And then compare year from input file to fetched year.&lt;BR /&gt;If matches , those rows should come in output.&lt;BR /&gt;&lt;BR /&gt;If comparison for years is not working ..Have tried reading input year in chat..Integer both..But nothing working.&lt;BR /&gt;Can some one please help..Urgent&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Don't hijack other people's threads, start your own.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post your code and the log of the whole step.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2017 17:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-year-and-month-from-date-in-SAS/m-p/393643#M94822</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-09-06T17:44:43Z</dc:date>
    </item>
  </channel>
</rss>

