<?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 a non imputed date value in a variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-non-imputed-date-value-in-a-variable/m-p/425970#M281222</link>
    <description>&lt;P&gt;I have a character date variable of format dd-MMM-yyyy in which some of the values are in the format -MMM-yyyy. i want to remove the first "-" only from these values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using this code&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if length(date1) ne 11 then col1 = substr(date1,2,8);
else col1 = date1;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I couldn't get the desired result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The sample date values are as below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="date1.jpg" style="width: 180px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17718iF5D66C7F00F6147A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="date1.jpg" alt="date1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2018 06:06:00 GMT</pubDate>
    <dc:creator>jayaprakash</dc:creator>
    <dc:date>2018-01-09T06:06:00Z</dc:date>
    <item>
      <title>How to extract a non imputed date value in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-non-imputed-date-value-in-a-variable/m-p/425970#M281222</link>
      <description>&lt;P&gt;I have a character date variable of format dd-MMM-yyyy in which some of the values are in the format -MMM-yyyy. i want to remove the first "-" only from these values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using this code&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if length(date1) ne 11 then col1 = substr(date1,2,8);
else col1 = date1;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I couldn't get the desired result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The sample date values are as below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="date1.jpg" style="width: 180px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17718iF5D66C7F00F6147A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="date1.jpg" alt="date1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 06:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-non-imputed-date-value-in-a-variable/m-p/425970#M281222</guid>
      <dc:creator>jayaprakash</dc:creator>
      <dc:date>2018-01-09T06:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a non imputed date value in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-non-imputed-date-value-in-a-variable/m-p/425971#M281223</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/157681"&gt;@jayaprakash&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If you're after tested code then please provide sample data in form of a SAS datastep creating such data and not in form of a screenshot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at the screenshot: Could it be that you've got leading blanks? If so then below could work:&lt;/P&gt;
&lt;PRE&gt;if length(left(date1)) ne 11 then col1 = substr(left(date1),2,8);&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 06:11:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-non-imputed-date-value-in-a-variable/m-p/425971#M281223</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-01-09T06:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a non imputed date value in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-non-imputed-date-value-in-a-variable/m-p/425973#M281224</link>
      <description>&lt;P&gt;Thanks for your help&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 06:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-a-non-imputed-date-value-in-a-variable/m-p/425973#M281224</guid>
      <dc:creator>jayaprakash</dc:creator>
      <dc:date>2018-01-09T06:31:55Z</dc:date>
    </item>
  </channel>
</rss>

