🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 12-23-2021 06:48 AM
(878 views)
Dear All,
I need to extract a sub set of data from the text file. Here i have attached the input text file .
I have given the output below. when ever i pass the parameter PVDG or any other it should extract the data from text file.
O/P:
A B C
10.00000 0.12668 0.01316
35.78947 0.03436 0.01361
61.57895 0.01944 0.01426
87.36842 0.01340 0.01506
113.15789 0.01017 0.01601
138.94737 0.00820 0.01711
164.73684 0.00689 0.01832
190.52632 0.00599 0.01962
216.31579 0.00533 0.02097
242.10526 0.00484 0.02234
270.00000 0.00444 0.02383
293.68421 0.00417 0.02507
319.47368 0.00393 0.02640
345.26316 0.00374 0.02770
371.05263 0.00358 0.02896
396.84211 0.00344 0.03019
422.63158 0.00332 0.03138
448.42105 0.00322 0.03254
474.21053 0.00313 0.03367
500.00000 0.00305 0.03476
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
%let key= PVDG ;
data want;
infile 'c:\temp\test.txt' termstr=lf encoding='utf8' length=len;
input have $varying200. len;
retain found .;
if have =: "&key." then found=1;
if have ne: "&key." and anyalpha(have)=1 then found=0;
if found;
run;
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
%let key= PVDG ;
data want;
infile 'c:\temp\test.txt' termstr=lf encoding='utf8' length=len;
input have $varying200. len;
retain found .;
if have =: "&key." then found=1;
if have ne: "&key." and anyalpha(have)=1 then found=0;
if found;
run;