<?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: Dropping day and month from date (character variable) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390074#M93538</link>
    <description>&lt;P&gt;Which method did you try?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Psot your code and log.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159570"&gt;@Jack_Smitherson&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;When I run the code on SAS, this is the message that I get:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"WARNING: Multiple lengths were specified for the variable VERDATE by input data set(s). This can&lt;BR /&gt;cause truncation of data."&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Aug 2017 00:50:39 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-08-23T00:50:39Z</dc:date>
    <item>
      <title>Dropping day and month from date (character variable)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390045#M93526</link>
      <description>&lt;P&gt;Hey everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a character variable on a SAS profile that has the year, month and day in the following format (example): 20120921.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to drop the month and day, in order to go from&amp;nbsp;&lt;SPAN&gt;20120921 to 2012. Could you please help me figure out the code I'd need to do that on SAS?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 21:49:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390045#M93526</guid>
      <dc:creator>Jack_Smitherson</dc:creator>
      <dc:date>2017-08-22T21:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping day and month from date (character variable)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390047#M93527</link>
      <description>&lt;P&gt;If it's a character use the SUBSTR() function to retrieve the first 4 characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend storing your date as a SAS date then you could use the YEAR function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 21:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390047#M93527</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-22T21:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping day and month from date (character variable)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390054#M93528</link>
      <description>&lt;P&gt;If you're sure this is the right thing to do, here's a really easy way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;length my_date_var $ 4;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the variable now only contains 4 characters, there's only room to store the first four characters.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 22:35:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390054#M93528</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-22T22:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping day and month from date (character variable)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390058#M93529</link>
      <description>&lt;P&gt;Thanks for your response. Unfortunately, when I run that code, the character variable doesn't shrink down to 4 for some reason... I doubled checked on SAS and this variable in fact a character variable&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 23:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390058#M93529</guid>
      <dc:creator>Jack_Smitherson</dc:creator>
      <dc:date>2017-08-22T23:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping day and month from date (character variable)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390060#M93530</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159570"&gt;@Jack_Smitherson&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for your response. Unfortunately, when I run that code, the character variable doesn't shrink down to 4 for some reason... I doubled checked on SAS and this variable in fact a character variable&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you change the name of the variable to match your variable name?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 23:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390060#M93530</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-22T23:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping day and month from date (character variable)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390061#M93531</link>
      <description>&lt;P&gt;Yes of course haha&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 23:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390061#M93531</guid>
      <dc:creator>Jack_Smitherson</dc:creator>
      <dc:date>2017-08-22T23:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping day and month from date (character variable)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390064#M93533</link>
      <description>&lt;P&gt;When I run the code on SAS, this is the message that I get:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"WARNING: Multiple lengths were specified for the variable VERDATE by input data set(s). This can&lt;BR /&gt;cause truncation of data."&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 23:46:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390064#M93533</guid>
      <dc:creator>Jack_Smitherson</dc:creator>
      <dc:date>2017-08-22T23:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping day and month from date (character variable)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390074#M93538</link>
      <description>&lt;P&gt;Which method did you try?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Psot your code and log.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159570"&gt;@Jack_Smitherson&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;When I run the code on SAS, this is the message that I get:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"WARNING: Multiple lengths were specified for the variable VERDATE by input data set(s). This can&lt;BR /&gt;cause truncation of data."&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 00:50:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390074#M93538</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-23T00:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping day and month from date (character variable)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390272#M93587</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159570"&gt;@Jack_Smitherson&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;When I run the code on SAS, this is the message that I get:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"WARNING: Multiple lengths were specified for the variable VERDATE by input data set(s). This can&lt;BR /&gt;cause truncation of data."&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This tells us that you have multiple data sets and that the lengths of a variable are different in each. If this is the date variable you are manipulating then the description you started with may be inaccurate for some of the data due to truncation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And it may be time to show the exact code you ran that did not work as needed.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 14:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-day-and-month-from-date-character-variable/m-p/390272#M93587</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-23T14:43:11Z</dc:date>
    </item>
  </channel>
</rss>

