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          data "/var/tmp/mylib/class";
2               set sashelp.class;
3               keep age name;
4          run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set /var/tmp/mylib/class has 19 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
      real time           0.08 seconds
      cpu time            0.03 seconds

% ls -l /var/tmp/mylib
-rw-rw-r-- 1 sas sas 131072  8月 28 17:39 2018 class.sas7bdat