This question continues from my previous Skipping Invalid Lines post. I have multiple data as follows. Date,Open,High,Low,Close,Adj Close,Volume
1960-01-04,4.520000,4.520000,4.520000,4.520000,4.520000,0
1960-01-05,4.550000,4.550000,4.550000,4.550000,4.550000,0
1960-01-06,4.680000,4.680000,4.680000,4.680000,4.680000,0
1960-01-07,4.630000,4.630000,4.630000,4.630000,4.630000,0
1960-01-08,4.590000,4.590000,4.590000,4.590000,4.590000,0
1960-01-10,null,null,null,null,null,null
1960-01-11,4.540000,4.540000,4.540000,4.540000,4.540000,0
1960-01-12,4.540000,4.540000,4.540000,4.540000,4.540000,0
1960-01-13,4.560000,4.560000,4.560000,4.560000,4.560000,0
1960-01-14,4.510000,4.510000,4.510000,4.510000,4.510000,0
1960-01-15,4.490000,4.490000,4.490000,4.490000,4.490000,0
1960-01-17,null,null,null,null,null,null
1960-01-18,4.370000,4.370000,4.370000,4.370000,4.370000,0
1960-01-19,4.310000,4.310000,4.310000,4.310000,4.310000,0 Date,Open,High,Low,Close,Adj Close,Volume
1927-12-30,17.660000,17.660000,17.660000,17.660000,17.660000,0
1928-01-03,17.760000,17.760000,17.760000,17.760000,17.760000,0
1928-01-04,17.719999,17.719999,17.719999,17.719999,17.719999,0
1928-01-05,17.549999,17.549999,17.549999,17.549999,17.549999,0
1928-01-06,17.660000,17.660000,17.660000,17.660000,17.660000,0
1928-01-09,17.500000,17.500000,17.500000,17.500000,17.500000,0
1928-01-10,17.370001,17.370001,17.370001,17.370001,17.370001,0
1928-01-11,17.350000,17.350000,17.350000,17.350000,17.350000,0
1928-01-12,17.469999,17.469999,17.469999,17.469999,17.469999,0
1928-01-13,17.580000,17.580000,17.580000,17.580000,17.580000,0
1928-01-16,17.290001,17.290001,17.290001,17.290001,17.290001,0
1928-01-17,17.299999,17.299999,17.299999,17.299999,17.299999,0
1928-01-18,17.260000,17.260000,17.260000,17.260000,17.260000,0
1928-01-19,17.379999,17.379999,17.379999,17.379999,17.379999,0
1928-01-20,17.480000,17.480000,17.480000,17.480000,17.480000,0
1928-01-23,17.639999,17.639999,17.639999,17.639999,17.639999,0
1928-01-24,17.709999,17.709999,17.709999,17.709999,17.709999,0
1928-01-25,17.520000,17.520000,17.520000,17.520000,17.520000,0
1928-01-26,17.629999,17.629999,17.629999,17.629999,17.629999,0
1928-01-27,17.690001,17.690001,17.690001,17.690001,17.690001,0
1928-01-30,17.490000,17.490000,17.490000,17.490000,17.490000,0
1928-01-31,17.570000,17.570000,17.570000,17.570000,17.570000,0
1928-02-01,17.530001,17.530001,17.530001,17.530001,17.530001,0 I want to not read and skip the ugly null s in the first data, and this can be done by only importing non- null lines from _infile_ as follows. data irx;
infile 'https://query1.finance.yahoo.com/v7/finance/download/^irx
?period1=-9999999999&period2=9999999999' url firstobs=2 dsd truncover;
input @;
if index(_infile_,"null")=0;
input date yymmdd10. +1 open hi lo close adj vol;
run; But I'm now importing multiple files together using filevar option as follows. data all;
input id $ @@;
url=compress("https://query1.finance.yahoo.com/v7/finance/download/"||id||
"?period1="||dhms("1jan1901"d,0,0,0)-315619200||
'&period2='||dhms("31dec2100"d,23,59,59)-315619200);
infile dummy url filevar=url firstobs=2 dsd truncover end=last;
do until(last);
input @;
if index(_infile_,"null")=0;
input date yymmdd10. +1 open hi lo close adj vol;
output;
end;
cards;
^irx ^gspc
; and this code reads only the first five lines from the first data—before encountering the null at the sixth line. It seems input @; and if index(_infile_,"null")=0; somehow affects variable last , but I'm not sure. How should I detour this problem?
... View more