2018年8月28日火曜日

データステップにデータセット名ではなく、パスを直接書く

データステップの書き方で、データセット名ではなくファイルのパスを直接書けます。これは、同僚に教えてもらいました。マニュアルを見ると、以下のようにTIPSとして記述がありました。 Tips:Instead of using a data set name, you can specify the physical pathname to the file, using syntax that your operating system understands. The pathname must be enclosed in single or double quotation marks.
  1. 1          data "/var/tmp/mylib/class";  
  2. 2               set sashelp.class;  
  3. 3               keep age name;  
  4. 4          run;  
  5.   
  6. NOTE: There were 19 observations read from the data set SASHELP.CLASS.  
  7. NOTE: The data set /var/tmp/mylib/class has 19 observations and 2 variables.  
  8. NOTE: DATA statement used (Total process time):  
  9.       real time           0.01 seconds  
  10.       cpu time            0.01 seconds  
  11.   
  12.   
  13. NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414  
  14. NOTE: The SAS System used:  
  15.       real time           0.08 seconds  
  16.       cpu time            0.03 seconds  
  17.   
  18. % ls -l /var/tmp/mylib  
  19. -rw-rw-r-- 1 sas sas 131072  8月 28 17:39 2018 class.sas7bdat