私はPROC手段とStackODSOutputオプションを使用するのに奇妙な問題があります。この例を考えてみましょう。SAS PROCは、StackODSOutputを使用しています:「ラベル」という変数です
まず、解析用のダミーデータセットを作成します。
/* Step-1: Create a dummy dataset for analysis */
data ds1;
label x = 'Variable X';
label y = 'Variable Y';
do i = 1 to 100;
x = ranuni(1234);
y = ranuni(5678);
keep x y;
output;
end;
run;
次に、StackODSOutputオプションを指定してPROC MEANSを実行します。これにより、 "stats"という出力データセットが作成されます。
/* Step-2: I run PROC means to capture the output in a dataset called stats */
proc means data=ds1 StackODSOutput mean;
var x y;
ods output summary=stats;
run;
この「統計」データセットには「ラベル」という変数があります。私はprocの内容を行うので変数が存在することを知っています、そして、変数をそこに見ます。
/* Step-3: Confirm visually that there is a variable called Label in stats dataset */
proc contents data=stats varnum; run;
ただし、「ラベル」という名前のこの変数はどこでも参照できません。たとえば、次のPROC SQL文はエラーを生成します。私は "Stats"データセットの他のすべての変数を何の問題もなく参照することができます。次のように
/* Step-4: But, I cannot seem to reference the variable called "Label" in stats dataset! */
proc sql;
select Variable, Label from stats;
quit;
エラーがある:私は何か間違ったことをやっている場合
43 proc sql;
44 select Variable, Label from stats;
ERROR: The following columns were not found in the contributing tables: Label.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
45 quit;
あなたは知っていますか?私のSASコードまたはSASのインストールに何か問題がありますか?
MY SASバージョンはSAS 9.3(9.03.01M2P08152012)です。
ありがとうございました。
Karthik。
Reezaの要請に応じて、ここには完全なログ出力があります。
1 The SAS System 15:52 Wednesday, November 9, 2016
1 %_eg_hidenotesandsource;
5 %_eg_hidenotesandsource;
20
21 /* Step-1: Create a dummy dataset for analysis */
22 data ds1;
23 label x = 'Variable X';
24 label y = 'Variable Y';
25 do i = 1 to 100;
26 x = ranuni(1234);
27 y = ranuni(5678);
28 keep x y;
29 output;
30 end;
31 run;
NOTE: The data set WORK.DS1 has 100 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
32
33 /* Step-2: I run PROC means to capture the output in a dataset called stats */
34 proc means data=ds1 StackODSOutput mean;
35 var x y;
36 ods output summary=stats;
37 run;
NOTE: The data set WORK.STATS has 2 observations and 3 variables.
NOTE: There were 100 observations read from the data set WORK.DS1.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.06 seconds
cpu time 0.03 seconds
38
39 /* Step-3: Confirm visually that there is a variable called Label in stats dataset */
40 proc contents data=stats varnum; run;
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
41
42 /* Step-4: But, I cannot seem to reference the variable called "Label" in stats dataset! */
43 proc sql;
44 select Variable, Label from stats;
ERROR: The following columns were not found in the contributing tables: Label.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
45 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
2 The SAS System 15:52 Wednesday, November 9, 2016
46 /* What! */
47
48
49
50 %_eg_hidenotesandsource;
62
63
64 %_eg_hidenotesandsource;
67
コードが私のために正常に動作します。一度にすべてを実行してもう一度チェックしてください。おそらくどこかで何かを忘れたかもしれません。 SASのどのバージョンを使用していますか?私は9.4 TS1M3です。まだ動作していない場合は、実行中のコードからフルログを1回実行してください。 – Reeza
私のSASバージョンはSAS 9.3(9.03.01M2P08152012)です。また、SASの全ログを追加しました。 – Karthik
'option validvarname = v7;'を設定してみてください。始めにやり直してください。何も行っていなければ、procの内容を出力してください。私はテクニカルサポートでこれを提起することも提案します。既知の問題の場合は、正しい方向に向けることができます。または少なくともそれを追跡することができます。 – Reeza