I am trying to read in data from all of the files from a particular directory. My variable "allpath" specifies the location of each file. I am starting to read each file at observation 18. However, some files do not contain at least 18 lines. What happens is that upon the first occurrence of a file with <18 lines, I receive a "NOTE: LOST CARD." statement and an error message, then the file read-in process stops. I have all of the data read in up to that point output to jtest, but nothing beyond that. I was on the verge of hardcoding to delete those records from "allpath", but I prefer to handle it automatically by having SAS either ignore those files, given the inadequate number of data lines or export a row of missing variables for those files. QUESTION: How do I keep reading in additional files after having a file without data? Thanks for your help! shorine Here is my code (dataset jabc1 contains all of the pathing to the files): data jtest; set jabc1; format flagjet 3.; do until(done); infile indummy filevar=allpath firstobs=18 obs=317 end=done; input @1 anyrec $4.; if done then flagjet=1; output; end; run; Here is the error message from my log (there are approx 65 files to read in, so not all are being processed): NOTE: LOST CARD. subjid=1234 visit=1 task=ABC allpath=D:\MYFOLDER\ABC_Subj1234_Visit1_Rep1.txt flagjet=. done=1 anyrec= _ERROR_=1 _N_=27 NOTE: There were 27 observations read from the data set WORK.JABC1. NOTE: The data set WORK.JTEST has 7204 observations and 6 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds An inadequate dataset looks like: ************************************************************* 2018-04-10 10:18:44 AM Subject:1234 Visit:1 A good dataset looks like: ************************************************************* 2017-08-17 12:23:50 PM Subject:4321 Visit:1 Criterion1: zz Criterion2; d Criterion3: w - - - - - - - - - - 1 d 2 f 3 d 4 c 5 e ... up to 300 records
... View more