Hi. I am attempting to use the methods outlined in this blog post:
https://blogs.sas.com/content/sasdummy/2018/10/09/read-multiple-text-files/
to import multiple text files from a folder using a wildcard.
- Example Code from Blog Post Above -
data accel; infile "/home/chris.hemedinger/tsv/*.tsv" dlm='09'x; length counter 8 timestamp 8 x 8 y 8 z 8 filename $ 25; input counter timestamp x y z filename; run;
However, each of my files has field names in the first row and it appears that including the firstobs=2 option only applies to the first file contained in the folder. As a result, SAS is attempting to read in the first row of all my datasets (minus the first dataset) as data and I am getting a lot of messages in the log about invalid data.
At this point, I have included a conditional statement to later delete these unwanted rows. This method works, but I was wondering if there is a better method that communicates to SAS to skip the first row of every dataset it is attempting to read in.
Thanks!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.