<?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: SAS data step infile delimiter questions in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-data-step-infile-delimiter-questions/m-p/168882#M1890</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your first question is backward.&amp;nbsp; The FORMAT attached to a variable just defines how it should be displayed.&amp;nbsp; It is only as a side effect that it has an impact on the defined length of the variable. The real problem with this example is the attachment of permanent FORMAT and INFORMAT to simple character variables.&amp;nbsp; These can cause trouble for later users. If they inadvertently get attached to a longer variable the values will appear as if they have been truncated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you tell SAS to use the DSD option then two adjacent delimiters are treated as an indication of a missing value.&amp;nbsp; So if in you example the line had two spaces between 'ABC' and '123' then GRADE_ID would be assigned a missing value and the '123' would be ignored.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Aug 2014 15:45:38 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2014-08-20T15:45:38Z</dc:date>
    <item>
      <title>SAS data step infile delimiter questions</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-data-step-infile-delimiter-questions/m-p/168881#M1889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I came across a data step like this in my program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test&amp;nbsp; ; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile '/sasdata/REF.txt'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lrecl = 256&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delimiter = '&amp;nbsp;&amp;nbsp;&amp;nbsp; '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dsd&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; missover&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstobs = 2; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; attrib MODEL_NM length = $11&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format = $11.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat = $11.;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input MODEL_NM;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;attrib GRADE_ID length = $3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format = $3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat = $3.; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input MODEL_NM GRADE_ID&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My questions are:&lt;/P&gt;&lt;P&gt;1. Why we need to specify length explicitly, when it is already specified in the format and informat?&lt;/P&gt;&lt;P&gt;2. The delimiter '&amp;nbsp; '---&amp;gt; if the column model_nm has a value like 'ABC&amp;nbsp; 123' will it read correctly as one column...or as separate columns because of the space?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Aug 2014 15:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/SAS-data-step-infile-delimiter-questions/m-p/168881#M1889</guid>
      <dc:creator>eagles_dare13</dc:creator>
      <dc:date>2014-08-20T15:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS data step infile delimiter questions</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-data-step-infile-delimiter-questions/m-p/168882#M1890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your first question is backward.&amp;nbsp; The FORMAT attached to a variable just defines how it should be displayed.&amp;nbsp; It is only as a side effect that it has an impact on the defined length of the variable. The real problem with this example is the attachment of permanent FORMAT and INFORMAT to simple character variables.&amp;nbsp; These can cause trouble for later users. If they inadvertently get attached to a longer variable the values will appear as if they have been truncated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you tell SAS to use the DSD option then two adjacent delimiters are treated as an indication of a missing value.&amp;nbsp; So if in you example the line had two spaces between 'ABC' and '123' then GRADE_ID would be assigned a missing value and the '123' would be ignored.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Aug 2014 15:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/SAS-data-step-infile-delimiter-questions/m-p/168882#M1890</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-08-20T15:45:38Z</dc:date>
    </item>
  </channel>
</rss>

