Neither the do While or Do Until loop are working as to be expected. First example is Do While, there are four records in data set "ds" that meet the criteria, The dsname variable of the first record is passed to the macro, which unzips the data set with an extension of ".gz", Otherwise the dataset is not touched, Loop terminates after one record in unpacked. For this dataset - which is just a list of file names in the folder - /data/dev/share/test - four records meet the criteria. The variable "ddname" correctly resolves to dsname, which is simply the name of the .gz dataset. Code to create data set of file names in directory: %let path='/data/dev/share/test'; filename parent "&path"; data files; length fullfilename $90; length dsname $34; length ext $3; /*declaring ext(tension) var, but not populating, same with dsname */ drop rc did i; did=dopen("parent"); if did > 0 then do; do i=1 to dnum(did); fullfilename=dread(did,i); output; end; rc=dclose(did); end; else put 'Could not open directory'; run; data ds; set files; /*now populate ext var, dsname */ ext=substr(fullfilename,length(fullfilename)-2,3); dsname=substr(fullfilename,1,index(fullfilename, '.')-1); run; Do while Loop (doesn't work): DATA _null_; length ddname $67.; DATA _null_; set ds; do while (ext = ".gz"); call symput('ddName', dsName); %Macro1(data/dev/share/test,&ddname /data//dev/share/tmp); END; RUN; The Do Until does no better: DATA _null_; length ddname $67.; DO UNTIL (EOF); SET ds END=EOF; WHERE ext = ".gz"; call symput('ddName', dsName); %Macro1(/data/dev/share/test,&ddname,/data/dev/share/tmp); END; RUN; Again, the variable "ddName" correctly resolves to the name of the first record of a .gz data set, no more records are processed after the first data set is unpacked. I need the loops to continue until all the records are processed that meet the criteria ext = "gz", not just one. There may be several hundred data sets in the folder, a couple hundred sas7bdat, a couple hundred sas7bdat.gz What alternatives are there for looping through a data set and then acting (passing variable dsname to a macro that unpacks the compressed datasets to a temporary folder)?:
... View more