data &state.&sheet.; set di; retain &header.; infile in filevar= path end=done missover; until(done); if _n_ =1 input &headerlength.; input &allvar.; output; end;run; variable path in di data set.
i wanna read multiple txt files 1 sas data set. in each txt file first row header , want retain header each observation used if _n_ = 1 input header input second row of other variables analysis.
the output strange. first row contains header , other rows not correct observations.
could me little bit? thank much.
i shenglin chen's answer, here's option: reset row counter 1 each time data step starts importing new file.
data &state.&sheet.; set di; retain &header.; infile in filevar= path end=done missover; _n_ = 1 1 until(done); if _n_ = 1 input &headerlength.; input &allvar.; output; end; run; this generalises more in case ever want different every nth row within each file.
Comments
Post a Comment