<?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: Reading Date - Zeroes Replaced With Spaces in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Zeroes-Replaced-With-Spaces/m-p/428039#M105627</link>
    <description>&lt;P&gt;Assuming the date field is DOB -&lt;/P&gt;
&lt;P&gt;1) read it as char type&amp;nbsp; DOB_char $8.&lt;/P&gt;
&lt;P&gt;2) replace spaces by zeros:&amp;nbsp; DOB = translate(DOB_char,'0',' ');&lt;/P&gt;
&lt;P&gt;3) use input function to get the sas numeric date:&amp;nbsp; DOB = input(DOB_char, yymmdd8.);&lt;/P&gt;
&lt;P&gt;4) optionally drop the origin date:&amp;nbsp; DROP DOB_char;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jan 2018 14:50:40 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2018-01-16T14:50:40Z</dc:date>
    <item>
      <title>Reading Date - Zeroes Replaced With Spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Zeroes-Replaced-With-Spaces/m-p/428026#M105622</link>
      <description>&lt;P&gt;Hopefully an easy one for the experts this morning:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a program with column inputs to read a&amp;nbsp;fixed width .dat file&amp;nbsp;of birth certificate data.&amp;nbsp; In years past, dates were listed&amp;nbsp;&lt;U&gt;with&lt;/U&gt; zeroes&amp;nbsp;(e.g., 20150101).&amp;nbsp; The newest file replaces the zeroes with spaces (e.g., 2015 1 1), and I am getting several missing values for any variables with dates.&amp;nbsp; I figure this has something to do with SAS interpreting the space as a delimiter within these fields?&amp;nbsp; I thought it would read all of the data between column 132 and column 140 regardless because of using &lt;STRONG&gt;8.&lt;/STRONG&gt; in yymmdd8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;infile '\\FILEPATH\birth2016.dat' truncover lrecl=4096;&lt;BR /&gt;input&lt;BR /&gt;@1 transcode $1.&lt;BR /&gt;@2 century $2.&lt;BR /&gt;@4 birthyr $2.&lt;BR /&gt;@6 certno $5.&lt;BR /&gt;@63 fname $40.&lt;BR /&gt;@103 lname $25.&lt;BR /&gt;@128 suffix $4.&lt;BR /&gt;@132 DOB yymmdd8.&lt;/P&gt;&lt;P&gt;@140 hourbirth&amp;nbsp; $2.&lt;/P&gt;&lt;P&gt;[REMAINING CODE for 50+ variables]&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 14:33:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Zeroes-Replaced-With-Spaces/m-p/428026#M105622</guid>
      <dc:creator>cgray</dc:creator>
      <dc:date>2018-01-16T14:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date - Zeroes Replaced With Spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Zeroes-Replaced-With-Spaces/m-p/428038#M105626</link>
      <description>&lt;P&gt;Get the file fixed.&amp;nbsp; "2015 1 1" is pretty much meaningless in terms of any format.&amp;nbsp; There is no standard like that I can think of.&amp;nbsp; You could read in as text, then tranwrd in the 0's, but I would push the work back on the person who cannot supply you good data.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 14:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Zeroes-Replaced-With-Spaces/m-p/428038#M105626</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-16T14:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Date - Zeroes Replaced With Spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Zeroes-Replaced-With-Spaces/m-p/428039#M105627</link>
      <description>&lt;P&gt;Assuming the date field is DOB -&lt;/P&gt;
&lt;P&gt;1) read it as char type&amp;nbsp; DOB_char $8.&lt;/P&gt;
&lt;P&gt;2) replace spaces by zeros:&amp;nbsp; DOB = translate(DOB_char,'0',' ');&lt;/P&gt;
&lt;P&gt;3) use input function to get the sas numeric date:&amp;nbsp; DOB = input(DOB_char, yymmdd8.);&lt;/P&gt;
&lt;P&gt;4) optionally drop the origin date:&amp;nbsp; DROP DOB_char;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 14:50:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Date-Zeroes-Replaced-With-Spaces/m-p/428039#M105627</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-01-16T14:50:40Z</dc:date>
    </item>
  </channel>
</rss>

