I'm looking to get the output of unix command
%let myfile = x 'ls -tr /sas/data/mydata | tail -1';
to be added into the sas program as a variable &myfile to use in the program and I can get awa from hardcoded filenames.
This macro, not mine, will generate the directory listing of a folder into a data set and can recursively search the subfolders. Set the depth to control it not searching.
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.