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!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.