Thank you! This code worked. I have one issue in that the first WANT1 variable name was changed for this post to higlight the columns I needed, but in the datasets, it is labeled as "Distance(nm)". SAS does not like this and gives me all "." in my matrix. This is OK because these values are the same across all datasets, so I can do this manually, but any advice about importing this variable as well would be helpful. I have also been referencing the options to automate this process and correctly label WANT2 as associated with a particular dataset (AB+BC1-0 in this case). I assume this would look something like rename WANT2 = WANT2'_thisFile_'? I'm trying to get the pipe to work now. I tried using the code above, but I keep getting the error: ERROR: Insufficient authorization to access PIPE. ERROR: Error in the FILENAME statement. The path for the first file is as follows: '/folders/myshortcuts/ExperimentFiles/AB+BC1-0.dat' This is what I have: %let pat'/folders/myshortcuts/ExperimentFiles'; <-? filename dirlist pipe "dir /b ""&path\*.dat"""; data want; length _thisFile $500; infile dirlist truncover; input _thisFile :$500.; _thisFile=cats("&path\",_thisFile); infile _dummy_ filevar=_thisFile end=last dlm='09'x dsd truncover termstr=cr firstobs=19; do until(last=1); input (WANT1 Dar Ref Smp Tx WANT2 R) (:$2.); keep WANT2; rename WANT2 = WANT2'_thisFile_'; <-? output; end; run;
... View more