Output list of files and folders to a dataset


/ Published in: SAS
Save to your folder(s)

This simple, straightforward method should work on multiple platforms (other methods involving OS specific commands and pipes are less flexible).


Copy this code and paste it in your HTML
  1. filename parent "/lvl1/lvl2";
  2.  
  3. data files_and_folders;
  4. length name $50;
  5. drop rc did i;
  6. did=dopen("parent");
  7. if did > 0 then do;
  8. do i=1 to dnum(did);
  9. name=dread(did,i);
  10. output;
  11. end;
  12. rc=dclose(did);
  13. end;
  14. else put 'Could not open directory';
  15. run;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.