<?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 a CSV file in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95526#M27042</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Tom, for your input!&amp;nbsp; That worked beautifully.&lt;/P&gt;&lt;P&gt;I really appreciate it &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Apr 2013 14:08:57 GMT</pubDate>
    <dc:creator>KevinC_</dc:creator>
    <dc:date>2013-04-03T14:08:57Z</dc:date>
    <item>
      <title>Reading a CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95521#M27037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to read a csv file.&amp;nbsp; For some reason my SAS code is reading beyond the last row.&amp;nbsp; To be more specific, the input file has 2101 rows, but SAS reads in 2706 rows.&amp;nbsp; Therefore, the last 605 rows are blank.&amp;nbsp; Here is my SAS code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data nov1 infile "my_dir\nov1.csv' delimiter = ',' missover DSD lrecl=32767 firstobs=2;&lt;/P&gt;&lt;P&gt;input&lt;/P&gt;&lt;P&gt;col1 col2 col3 ... col31;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code works for other csv files.&amp;nbsp; Am i missing something obvious here?&lt;/P&gt;&lt;P&gt;I appreciate any input anyone may have &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 20:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95521#M27037</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2013-04-02T20:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95522#M27038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you get any interesting or unexpected messages in the log?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may need to specify TERMSTR but without knowing more that is just a guess.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 21:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95522#M27038</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-04-02T21:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95523#M27039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like your file just has some extra blank lines at the end.&lt;/P&gt;&lt;P&gt;Why not just delete the rows without any non-missing values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data nov1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; infile "my_dir\nov1.csv' delimiter = ',' missover DSD lrecl=32767 firstobs=2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;col1 - col31 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp; if 0=n(of col1-col31) then delete;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 22:01:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95523#M27039</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-04-02T22:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95524#M27040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you data_null and Tom!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;Your suggestion sounds great.&amp;nbsp; The only problem is the columns are not named 'col1 ... col31).&amp;nbsp; They are named like 'transaction_type', 'avg', 'cust_id',... etc.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would I adopt these columns in your suggestion?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 22:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95524#M27040</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2013-04-02T22:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95525#M27041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will have to type the names at least once.&amp;nbsp; I usually just read them from the file and change the delimiters to spaces and past them into the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can save some typing a couple of ways.&lt;/P&gt;&lt;P&gt;1) Put the names into a macro variable.&lt;/P&gt;&lt;P&gt;%let names=transaction_type avg .... last_var ;&lt;/P&gt;&lt;P&gt;input &amp;amp;names ;&lt;/P&gt;&lt;P&gt;if 0=n(of &amp;amp;names) then delete;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Use name ranges so you only have to retype the first and last variable name.&lt;/P&gt;&lt;P&gt;if 0=n(of transaction_type -- last_var) then delete ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 00:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95525#M27041</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-04-03T00:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95526#M27042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Tom, for your input!&amp;nbsp; That worked beautifully.&lt;/P&gt;&lt;P&gt;I really appreciate it &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 14:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-CSV-file/m-p/95526#M27042</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2013-04-03T14:08:57Z</dc:date>
    </item>
  </channel>
</rss>

