<?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: Extracting a subset of data from text file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786723#M251231</link>
    <description>&lt;P&gt;Do you mean something like this?:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile cards4 missover;
  input;

  if _INFILE_ =: '*SGT' then
    do until(a=.);
      input;
      a = input(scan(_INFILE_,1," "), ?? best32.);
      b = input(scan(_INFILE_,2," "), ?? best32.);
      if a&amp;gt;. then output;
    end;

cards4;
 **---------------------------- ROCK FLUID -------------------------------
*ROCKFLUID
*RPT
*SGT
      0.005     0.0      0.
      0.040     0.005    0.
      0.080     0.013    0.
      0.120     0.026    0.
      0.160     0.040    0.
      0.200     0.058    0.
      0.240     0.078    0.
      0.280     0.100    0.
      0.320     0.126    0.
      0.360     0.156    0.
      0.400     0.187    0.
      0.440     0.222    0.
      0.480     0.260    0.
      0.520     0.300    0.
      0.560     0.348    0.
      0.600     0.400    0.
      0.640     0.450    0.
      0.680     0.505    0.
      0.720     0.562    0.
      0.760     0.620    0.
      0.800     0.680    0.
      0.840     0.740    0.
*SWT
      0.160     0.0      0.
      0.200     0.002    0.
      0.240     0.010    0.
      0.280     0.020    0.
      0.320     0.033    0.
      0.360     0.049    0.
      0.400     0.066    0.
      0.440     0.090    0.
      0.480     0.119    0.
      0.520     0.150    0.
      0.560     0.186    0.
      0.600     0.227    0.
      0.640     0.277    0.
      0.680     0.330    0.
      0.720     0.390    0.
      0.760     0.462    0.
      0.800     0.540    0.
      0.840     0.620    0.
      0.880     0.710    0.
      0.920     0.800    0.
      0.960     0.900    0.
      0.995     1.0      0.
**-------------------------------- INITIAL CONDITION --------
*INITIAL
*VERTICAL *DEPTH_AVE *WATER_GAS
*REFPRES  3550.0
;;;;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
    <pubDate>Mon, 20 Dec 2021 12:40:13 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2021-12-20T12:40:13Z</dc:date>
    <item>
      <title>Extracting a subset of data from text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786710#M251226</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;I need to extract a sub set of data from the text file. Here i have attached the input text file .&lt;/P&gt;
&lt;P&gt;I have given the output below. when ever i pass the parameter SGT or any other it should extract the data from text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;P&gt;*SGT&lt;BR /&gt;0.005 0.0 0.&lt;BR /&gt;0.040 0.005 0.&lt;BR /&gt;0.080 0.013 0.&lt;BR /&gt;0.120 0.026 0.&lt;BR /&gt;0.160 0.040 0.&lt;BR /&gt;0.200 0.058 0.&lt;BR /&gt;0.240 0.078 0.&lt;BR /&gt;0.280 0.100 0.&lt;BR /&gt;0.320 0.126 0.&lt;BR /&gt;0.360 0.156 0.&lt;BR /&gt;0.400 0.187 0.&lt;BR /&gt;0.440 0.222 0.&lt;BR /&gt;0.480 0.260 0.&lt;BR /&gt;0.520 0.300 0.&lt;BR /&gt;0.560 0.348 0.&lt;BR /&gt;0.600 0.400 0.&lt;BR /&gt;0.640 0.450 0.&lt;BR /&gt;0.680 0.505 0.&lt;BR /&gt;0.720 0.562 0.&lt;BR /&gt;0.760 0.620 0.&lt;BR /&gt;0.800 0.680 0.&lt;BR /&gt;0.840 0.740 0.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 10:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786710#M251226</guid>
      <dc:creator>ngottala</dc:creator>
      <dc:date>2021-12-20T10:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a subset of data from text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786723#M251231</link>
      <description>&lt;P&gt;Do you mean something like this?:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile cards4 missover;
  input;

  if _INFILE_ =: '*SGT' then
    do until(a=.);
      input;
      a = input(scan(_INFILE_,1," "), ?? best32.);
      b = input(scan(_INFILE_,2," "), ?? best32.);
      if a&amp;gt;. then output;
    end;

cards4;
 **---------------------------- ROCK FLUID -------------------------------
*ROCKFLUID
*RPT
*SGT
      0.005     0.0      0.
      0.040     0.005    0.
      0.080     0.013    0.
      0.120     0.026    0.
      0.160     0.040    0.
      0.200     0.058    0.
      0.240     0.078    0.
      0.280     0.100    0.
      0.320     0.126    0.
      0.360     0.156    0.
      0.400     0.187    0.
      0.440     0.222    0.
      0.480     0.260    0.
      0.520     0.300    0.
      0.560     0.348    0.
      0.600     0.400    0.
      0.640     0.450    0.
      0.680     0.505    0.
      0.720     0.562    0.
      0.760     0.620    0.
      0.800     0.680    0.
      0.840     0.740    0.
*SWT
      0.160     0.0      0.
      0.200     0.002    0.
      0.240     0.010    0.
      0.280     0.020    0.
      0.320     0.033    0.
      0.360     0.049    0.
      0.400     0.066    0.
      0.440     0.090    0.
      0.480     0.119    0.
      0.520     0.150    0.
      0.560     0.186    0.
      0.600     0.227    0.
      0.640     0.277    0.
      0.680     0.330    0.
      0.720     0.390    0.
      0.760     0.462    0.
      0.800     0.540    0.
      0.840     0.620    0.
      0.880     0.710    0.
      0.920     0.800    0.
      0.960     0.900    0.
      0.995     1.0      0.
**-------------------------------- INITIAL CONDITION --------
*INITIAL
*VERTICAL *DEPTH_AVE *WATER_GAS
*REFPRES  3550.0
;;;;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 12:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786723#M251231</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-12-20T12:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a subset of data from text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786741#M251233</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let key=  *SGT ;

data want;
  infile 'c:\temp\k1r1.txt' termstr=lf length=len;
  input want $varying400. len;
  retain found .;
  if want =: "&amp;amp;key." then found=1;
  if first(want)='*' and  want ne: "&amp;amp;key." then found=0;
  if found;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Dec 2021 14:05:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786741#M251233</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-20T14:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a subset of data from text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786773#M251243</link>
      <description>Thank you. Yes, this is the output i needed&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Dec 2021 16:45:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786773#M251243</guid>
      <dc:creator>ngottala</dc:creator>
      <dc:date>2021-12-20T16:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a subset of data from text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786774#M251244</link>
      <description>Thank you for your solution. Yes, that's the output i needed</description>
      <pubDate>Mon, 20 Dec 2021 16:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-a-subset-of-data-from-text-file/m-p/786774#M251244</guid>
      <dc:creator>ngottala</dc:creator>
      <dc:date>2021-12-20T16:46:45Z</dc:date>
    </item>
  </channel>
</rss>

