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
%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;
%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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: