<?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: Read rows with a specific startwith from a csv file using infile in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-rows-with-a-specific-startwith-from-a-csv-file-using-infile/m-p/927180#M364897</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  file "R:\some_test_file.csv";
  put "2021-01-01,1,2,3";
  put "2021-01-02,4,5,6";
  put "2021-01-03,7,8,9";

  put "2021-09-01,1,2,3";
  put "2021-09-02,4,5,6";
  put "2021-09-03,7,8,9";
run;


filename f "R:\some_test_file.csv";
data want;
  infile f dlm=",";
  input @;
  if "2021-01" =: _infile_;
  input date yymmdd10. a b c;
  format date date11.;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2024 15:04:22 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2024-05-06T15:04:22Z</dc:date>
    <item>
      <title>Read rows with a specific startwith from a csv file using infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-rows-with-a-specific-startwith-from-a-csv-file-using-infile/m-p/927173#M364893</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to ask you if there is a way to read the rows from a csv file if starts with a specific string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example in this csv I want just the rows that starts with "2021-01", so the row that starts with 2021-09 will be deleted.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fabiopuddu_0-1715005620005.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96201iF3917A7E645B8C0D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fabiopuddu_0-1715005620005.png" alt="fabiopuddu_0-1715005620005.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 14:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-rows-with-a-specific-startwith-from-a-csv-file-using-infile/m-p/927173#M364893</guid>
      <dc:creator>harmonic</dc:creator>
      <dc:date>2024-05-06T14:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Read rows with a specific startwith from a csv file using infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-rows-with-a-specific-startwith-from-a-csv-file-using-infile/m-p/927180#M364897</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  file "R:\some_test_file.csv";
  put "2021-01-01,1,2,3";
  put "2021-01-02,4,5,6";
  put "2021-01-03,7,8,9";

  put "2021-09-01,1,2,3";
  put "2021-09-02,4,5,6";
  put "2021-09-03,7,8,9";
run;


filename f "R:\some_test_file.csv";
data want;
  infile f dlm=",";
  input @;
  if "2021-01" =: _infile_;
  input date yymmdd10. a b c;
  format date date11.;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 15:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-rows-with-a-specific-startwith-from-a-csv-file-using-infile/m-p/927180#M364897</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-05-06T15:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Read rows with a specific startwith from a csv file using infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-rows-with-a-specific-startwith-from-a-csv-file-using-infile/m-p/927183#M364900</link>
      <description>&lt;P&gt;Please provide sample data as text and not as screenshot - ideally via a SAS data step that creates the sample data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
  infile datalines4 truncover dsd dlm=';';
  input row_dt :yymmdd10. @;
  if put(row_dt,yymmn6.)='202101';
  input val :best32. next_var :$10.;
  format row_dt date9.;
datalines4;
2021-01-18;111;keep
2021-09-01;34;drop
2021-01-22;111;keep
.;111;keep
;;;;

proc print data=demo;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 May 2024 15:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-rows-with-a-specific-startwith-from-a-csv-file-using-infile/m-p/927183#M364900</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-06T15:20:27Z</dc:date>
    </item>
  </channel>
</rss>

