その名もProc SCAPROCです。なんて読むのでしょうね。
9.2からいるので、さして新しくもないですね。知ってました?
こいつの機能はずばりSAS Code Analyzerです。
ちょっと奥深いので、何回かにわけるかも。
とりあえず今回はさわりだけ。
実行されたSASコードが何をしているのかを分析し、その結果を出力してくれます。
「proc scaproc;record "★出力先指定" オプション;run;」
として、そこから
「proc scaproc; write; run;」までの間に実行されるSASコードが分析対象になります。
使い方的にはproc printtoに似てますね。
例えば
proc scaproc;
record "★出力先指定\record.txt"
attr
;
run;
data OUT;
set sashelp.class;
Z=999;
run;
proc summary data=sashelp.class(keep=age);
var age;
output out=summary mean=mean;
run;
proc scaproc; write; run;
とすると、
どんなデータセットが読み込まれ、どんなデータセットが出力されたのか?
ステップに何秒かかったか?動きのあったマクロ変数は?などの情報を、ちょっと人間には優しくない形式ですが、だしてくれます。オプションの種類と出力の解読方法についてはまた今度くわしく。
以下が出力されたファイルの中身です(一部抜粋)
* JOBSPLIT: DATASET INPUT SEQ #C00003.CLASS.DATA */
/* JOBSPLIT: DATASET OUTPUT SEQ WORK.OUT.DATA */
/* JOBSPLIT: ATTR #C00003.CLASS.DATA INPUT VARIABLE:Name TYPE:CHARACTER LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CLASS.DATA INPUT VARIABLE:Sex TYPE:CHARACTER LENGTH:1 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CLASS.DATA INPUT VARIABLE:Age TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CLASS.DATA INPUT VARIABLE:Height TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CLASS.DATA INPUT VARIABLE:Weight TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Make TYPE:CHARACTER LENGTH:13 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Model TYPE:CHARACTER LENGTH:40 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Type TYPE:CHARACTER LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Origin TYPE:CHARACTER LENGTH:6 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:DriveTrain TYPE:CHARACTER LENGTH:5 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:MSRP TYPE:NUMERIC LENGTH:8 LABEL: FORMAT:DOLLAR8. INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Invoice TYPE:NUMERIC LENGTH:8 LABEL: FORMAT:DOLLAR8. INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:EngineSize TYPE:NUMERIC LENGTH:8 LABEL:Engine Size (L) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Cylinders TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Horsepower TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:MPG_City TYPE:NUMERIC LENGTH:8 LABEL:MPG (City) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:MPG_Highway TYPE:NUMERIC LENGTH:8 LABEL:MPG (Highway) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Weight TYPE:NUMERIC LENGTH:8 LABEL:Weight (LBS) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Wheelbase TYPE:NUMERIC LENGTH:8 LABEL:Wheelbase (IN) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR #C00003.CARS.DATA INPUT VARIABLE:Length TYPE:NUMERIC LENGTH:8 LABEL:Length (IN) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Name TYPE:CHARACTER LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Sex TYPE:CHARACTER LENGTH:1 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Age TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Height TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Weight TYPE:NUMERIC LENGTH:8 LABEL:Weight (LBS) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Make TYPE:CHARACTER LENGTH:13 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Model TYPE:CHARACTER LENGTH:40 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Type TYPE:CHARACTER LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Origin TYPE:CHARACTER LENGTH:6 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:DriveTrain TYPE:CHARACTER LENGTH:5 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:MSRP TYPE:NUMERIC LENGTH:8 LABEL: FORMAT:DOLLAR8. INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Invoice TYPE:NUMERIC LENGTH:8 LABEL: FORMAT:DOLLAR8. INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:EngineSize TYPE:NUMERIC LENGTH:8 LABEL:Engine Size (L) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Cylinders TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Horsepower TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:MPG_City TYPE:NUMERIC LENGTH:8 LABEL:MPG (City) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:MPG_Highway TYPE:NUMERIC LENGTH:8 LABEL:MPG (Highway) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Wheelbase TYPE:NUMERIC LENGTH:8 LABEL:Wheelbase (IN) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Length TYPE:NUMERIC LENGTH:8 LABEL:Length (IN) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA OUTPUT VARIABLE:Z TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ELAPSED 5 */
/* JOBSPLIT: SYSSCP LIN X64 */
/* JOBSPLIT: PROCNAME DATASTEP */
/* JOBSPLIT: STEP SOURCE FOLLOWS */
data OUT;
set sashelp.class
sashelp.cars;
Z=999;
run;
/* JOBSPLIT: DATASET INPUT SEQ WORK.OUT.DATA */
/* JOBSPLIT: DATASET OUTPUT SEQ WORK.SUMMARY.DATA */
/* JOBSPLIT: FILE OUTPUT /home/morioka0380/record.txt */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Name TYPE:CHARACTER LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Sex TYPE:CHARACTER LENGTH:1 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Age TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Height TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Weight TYPE:NUMERIC LENGTH:8 LABEL:Weight (LBS) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Make TYPE:CHARACTER LENGTH:13 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Model TYPE:CHARACTER LENGTH:40 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Type TYPE:CHARACTER LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Origin TYPE:CHARACTER LENGTH:6 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:DriveTrain TYPE:CHARACTER LENGTH:5 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:MSRP TYPE:NUMERIC LENGTH:8 LABEL: FORMAT:DOLLAR8. INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Invoice TYPE:NUMERIC LENGTH:8 LABEL: FORMAT:DOLLAR8. INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:EngineSize TYPE:NUMERIC LENGTH:8 LABEL:Engine Size (L) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Cylinders TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Horsepower TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:MPG_City TYPE:NUMERIC LENGTH:8 LABEL:MPG (City) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:MPG_Highway TYPE:NUMERIC LENGTH:8 LABEL:MPG (Highway) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Wheelbase TYPE:NUMERIC LENGTH:8 LABEL:Wheelbase (IN) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Length TYPE:NUMERIC LENGTH:8 LABEL:Length (IN) FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.OUT.DATA INPUT VARIABLE:Z TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.SUMMARY.DATA OUTPUT VARIABLE:_TYPE_ TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.SUMMARY.DATA OUTPUT VARIABLE:_FREQ_ TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: ATTR WORK.SUMMARY.DATA OUTPUT VARIABLE:mean TYPE:NUMERIC LENGTH:8 LABEL: FORMAT: INFORMAT: */
/* JOBSPLIT: SYMBOL GET SYSSUMSTACKODS */
/* JOBSPLIT: SYMBOL GET SYSSUMTRACE */
/* JOBSPLIT: ELAPSED 8 */
/* JOBSPLIT: PROCNAME SUMMARY */
/* JOBSPLIT: STEP SOURCE FOLLOWS */
proc summary data=OUT;
var age;
output out=summary mean=mean;
run;
inputされたデータセットの変数情報とoutputの変数情報をだすためにattrオプションをつけてます。
これを使って差分を考えれば、一応、そのステップで新規に作成されたであろう変数を、ある程度特定できますね
0 件のコメント:
コメントを投稿