<?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 How to Extract text from Date column in SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Extract-text-from-Date-column-in-SAS/m-p/690302#M210010</link>
    <description>&lt;P&gt;Data is currently stored as date format, YYYYMM. However I would like to create a text column with just year and month. Meaning to say YYMM, I know this is not a good way to store data however I require it in that format. Meaning to say for YYYYMM = 201906, desired output = 1906. YYYYMM = 202006, desired output = 2006. YYYYMM = 200606, desired output = 0606.&lt;/P&gt;&lt;PRE&gt;data have;
infile datalines missover;
input yymm :yymmn6.;
format yymm yymmn6.;
datalines;
201904
201807
201912
202005
;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Oct 2020 10:04:33 GMT</pubDate>
    <dc:creator>sas_newbie94</dc:creator>
    <dc:date>2020-10-09T10:04:33Z</dc:date>
    <item>
      <title>How to Extract text from Date column in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Extract-text-from-Date-column-in-SAS/m-p/690302#M210010</link>
      <description>&lt;P&gt;Data is currently stored as date format, YYYYMM. However I would like to create a text column with just year and month. Meaning to say YYMM, I know this is not a good way to store data however I require it in that format. Meaning to say for YYYYMM = 201906, desired output = 1906. YYYYMM = 202006, desired output = 2006. YYYYMM = 200606, desired output = 0606.&lt;/P&gt;&lt;PRE&gt;data have;
infile datalines missover;
input yymm :yymmn6.;
format yymm yymmn6.;
datalines;
201904
201807
201912
202005
;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 10:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Extract-text-from-Date-column-in-SAS/m-p/690302#M210010</guid>
      <dc:creator>sas_newbie94</dc:creator>
      <dc:date>2020-10-09T10:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to Extract text from Date column in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Extract-text-from-Date-column-in-SAS/m-p/690308#M210014</link>
      <description>&lt;PRE&gt;data have;
infile datalines missover;
input yymm :yymmn6.;
format yymm yymmn6.;
want=cats(put(yymm,year2.),put(month(yymm),z2.));
datalines;
201904
201807
201912
202005
;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Oct 2020 11:00:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Extract-text-from-Date-column-in-SAS/m-p/690308#M210014</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-10-09T11:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to Extract text from Date column in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Extract-text-from-Date-column-in-SAS/m-p/690540#M210068</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines missover;
input yymm :yymmn6.;
format yymm yymmn4.;
datalines;
201904
201807
201912
202005
;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 83px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50503iCAA1F2E719256747/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 18:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Extract-text-from-Date-column-in-SAS/m-p/690540#M210068</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-10-09T18:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to Extract text from Date column in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Extract-text-from-Date-column-in-SAS/m-p/690568#M210073</link>
      <description>&lt;P&gt;If you just want to have the existing variable displayed without the century then just change the width of the format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format yymm yymmn4.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If instead want to create a character variable then use a PUT() function call.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;desired_output = put(yymm,yymmn4.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Oct 2020 19:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Extract-text-from-Date-column-in-SAS/m-p/690568#M210073</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-10-09T19:28:48Z</dc:date>
    </item>
  </channel>
</rss>

