<?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 Number of observations in 'output data' differs from number of observations in raw data file in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Number-of-observations-in-output-data-differs-from-number-of/m-p/895925#M39838</link>
    <description>&lt;P&gt;I am a (very) new SAS user who is working on a class project. I am graded for the number of observations in my 'output data' matching the number of observations in the raw data file. The raw data file has 1,242 observations, but when I run this code (see below) it gives me 1,238 observations.&amp;nbsp; What would be possible reasons for this discrepancy, and how can I fix it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;DATA CoImpt.Disabilities;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;INFILE "&amp;amp;CourseRoot/CDPHE Study/Data/1_Source/disabilities.txt" FIRSTOBS = 2 DELIMITER = '&amp;amp;' ;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;INPUT tract_fips&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $10.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pctn_disability :$4. ;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PROC CONTENTS;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 26 Sep 2023 16:52:38 GMT</pubDate>
    <dc:creator>BLT2023</dc:creator>
    <dc:date>2023-09-26T16:52:38Z</dc:date>
    <item>
      <title>Number of observations in 'output data' differs from number of observations in raw data file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Number-of-observations-in-output-data-differs-from-number-of/m-p/895925#M39838</link>
      <description>&lt;P&gt;I am a (very) new SAS user who is working on a class project. I am graded for the number of observations in my 'output data' matching the number of observations in the raw data file. The raw data file has 1,242 observations, but when I run this code (see below) it gives me 1,238 observations.&amp;nbsp; What would be possible reasons for this discrepancy, and how can I fix it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;DATA CoImpt.Disabilities;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;INFILE "&amp;amp;CourseRoot/CDPHE Study/Data/1_Source/disabilities.txt" FIRSTOBS = 2 DELIMITER = '&amp;amp;' ;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;INPUT tract_fips&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $10.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pctn_disability :$4. ;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PROC CONTENTS;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 26 Sep 2023 16:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Number-of-observations-in-output-data-differs-from-number-of/m-p/895925#M39838</guid>
      <dc:creator>BLT2023</dc:creator>
      <dc:date>2023-09-26T16:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Number of observations in 'output data' differs from number of observations in raw data file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Number-of-observations-in-output-data-differs-from-number-of/m-p/895927#M39839</link>
      <description>&lt;P&gt;Text files have LINES.&amp;nbsp; &amp;nbsp;Datasets have OBSERVATIONS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So do the&amp;nbsp; 1,242 lines include the header line you are skipping with the FIRSTOBS= option.&amp;nbsp; If so you should expect 1,241 observations in the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a few things that can cause your code to create fewer observations than lines of text read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One definite issue is that you are reading the first 10 bytes into&amp;nbsp;tract_fips which might be a problem if any of the lines have fewer than 10 bytes on them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You also did not include the TRUNCOVER option on your INFILE statement.&amp;nbsp; That will prevent SAS from going to the next line to find a value when the current line does not have enough values to satisfy the INPUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another possibility is that the actual lines are not delimited with the ampersand character, but actually are delimited with something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try fixing your code first:&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA CoImpt.Disabilities;
  INFILE "&amp;amp;CourseRoot/CDPHE Study/Data/1_Source/disabilities.txt"
     FIRSTOBS = 2 DELIMITER = '&amp;amp;'  truncover
  ;
  INPUT tract_fips      :$10.
        pctn_disability :$4. 
  ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Tue, 26 Sep 2023 17:13:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Number-of-observations-in-output-data-differs-from-number-of/m-p/895927#M39839</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-26T17:13:38Z</dc:date>
    </item>
  </channel>
</rss>

