BookmarkSubscribeRSS Feed

[파일읽기] 디렉토리에 저장되어 있는 동일한 형태의 파일 읽기

Started ‎06-15-2020 by
Modified ‎06-15-2020 by
Views 246

FTP에서 내려 받은 복수의 파일들을 읽기 위하여 사용되는 프로그램.

 

Sample 41880: Read all files from a directory and create separate SAS® data sets with unique names

http://support.sas.com/kb/41/880.html

 

filename DIRLIST pipe 'dir "C:\_today\file*.csv" /b ';

 

data dirlist ;

   infile dirlist lrecl=200 truncover;

   input file_name $100.;

run;

 

data _null_;

   set dirlist end=end;

   count+1;

   call symputx('read'||put(count,4.-l),cats('c:\_today\',file_name));

   call symputx('dset'||put(count,4.-l),scan(file_name,1,'.'));

   if end then call symputx('max',count);

run;

 

options mprint symbolgen;

%macro readin;

   %do i=1 %to &max;

 

      data &&dset&i;

         infile "&&read&i" lrecl=1000 truncover dsd;

         input var1 $ var2 $ var3 $;

       run;

 

   %end;

%mend readin;

 

%readin;

 

* 참고 : FTP 서버에서 ftp 명령어를 사용하여서 파일 내려 받기

 : http://cafe.daum.net/statsas/3F8j/374

 

Version history
Last update:
‎06-15-2020 02:55 AM
Updated by:
Contributors

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Article Labels
Article Tags