<?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 Looking for Ways to Only Read Specific Rows from a CSV File into SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862394#M340649</link>
    <description>&lt;P&gt;Hi! Is there a way to read specific rows of a CSV file into SAS or to limit the number of rows being read from a CSV file into SAS? For example, if you had a data set with 1000 rows, but you just wanted to read in the first 800 rows, is there a way to do so? Any input regarding this would be much appreciated. Thanks so much!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 05 Mar 2023 23:38:24 GMT</pubDate>
    <dc:creator>JackZ295</dc:creator>
    <dc:date>2023-03-05T23:38:24Z</dc:date>
    <item>
      <title>Looking for Ways to Only Read Specific Rows from a CSV File into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862394#M340649</link>
      <description>&lt;P&gt;Hi! Is there a way to read specific rows of a CSV file into SAS or to limit the number of rows being read from a CSV file into SAS? For example, if you had a data set with 1000 rows, but you just wanted to read in the first 800 rows, is there a way to do so? Any input regarding this would be much appreciated. Thanks so much!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2023 23:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862394#M340649</guid>
      <dc:creator>JackZ295</dc:creator>
      <dc:date>2023-03-05T23:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for Ways to Only Read Specific Rows from a CSV File into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862398#M340653</link>
      <description>&lt;P&gt;Something like this should do it. Just adjust for the number of columns and the maximum length you want to read:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp (compress=yes);
   infile 'myfile.csv' dsd truncover firstobs=2 obs=800;
   length x1-x100 $200 ;
   input x1-x100;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 02:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862398#M340653</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-03-06T02:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for Ways to Only Read Specific Rows from a CSV File into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862399#M340654</link>
      <description>&lt;P&gt;Thanks so much! I was actually wondering if it was possible to do it in a proc import procedure. My code is currently as follows:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;options MSGLEVEL=I;

options validvarname=v7;

proc import out=one

datafile='/home/user/Assessment/test_1.csv'

DBMS=csv replace;

getnames=yes;

run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2023 02:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862399#M340654</guid>
      <dc:creator>JackZ295</dc:creator>
      <dc:date>2023-03-06T02:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for Ways to Only Read Specific Rows from a CSV File into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862401#M340656</link>
      <description>&lt;P&gt;Unfortunately I don't think there is a PROC IMPORT option for this. However, if you add this before running PROC IMPORT you should see a DATA step in the SAS log that you can copy back into the SAS editor to add the OBS = option:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options source;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 03:17:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862401#M340656</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-03-06T03:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for Ways to Only Read Specific Rows from a CSV File into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862443#M340675</link>
      <description>&lt;P&gt;Proc Import generates and then executes a SAS data step (which you can see in the SAS log).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could set options obs=800 before proc import. This will lead for the generated data step to stop execution after row 800 is read.&lt;/P&gt;
&lt;P&gt;You then set options obs=max; right after proc import.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 09:06:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862443#M340675</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-03-06T09:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for Ways to Only Read Specific Rows from a CSV File into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862447#M340677</link>
      <description>&lt;P&gt;Using Powershell answered by ChatGPT:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;Import-Csv -Path "C:\path\to\csv\file.csv" | Select-Object -First 500 | Export-Csv -Path "C:\path\to\csv\first500.csv" -NoTypeInformation&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 09:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-Ways-to-Only-Read-Specific-Rows-from-a-CSV-File-into/m-p/862447#M340677</guid>
      <dc:creator>RD2</dc:creator>
      <dc:date>2023-03-06T09:54:04Z</dc:date>
    </item>
  </channel>
</rss>

