I have 9.1.3. In that version LSMeanDiffCL does not have the variable named in the LSMEANS statement. It has I and J and they relate to LSMeanNumber in the LSMEANS data set. Are you referring to ODS output data set LSMEANCL which does NOT have LSMeanNumber but is very similar to LSMEANS?
Merge LSMEANS with LSMEANSCL to get LSMeanNumber and you should be able to relate that to I J in LSMeanDiffCL.
[pre]
data test;
do rep=1 to 3;
do trt = 1 to 3;
y = ranuni(454545);
output;
end;
end;
run;
proc print;
run;
ods trace on;
proc glm;
class trt;
model y = trt;
lsmeans trt / cl pdiff;
ods output LSMeans=LSMeans LSMeanDiffCL=LSMeanDiffCL LSMeanCL=LSMeanCL;
run;
ods trace off;
proc contents varnum data=LSMeans;
ods select Position;
run;
proc print data=LSMeans;
run;
proc contents varnum data=LSMeanCL;
ods select Position;
run;
proc print data=LSMeanCL;
run;
proc contents varnum data=LSMeanDiffCL;
ods select Position;
run;
proc print data=LSMeanDiffCL;
run;
[/pre]
With output....
[pre]
The SAS System 117
06:16 Monday, March 15, 2010
The CONTENTS Procedure
Variables in Creation Order
# Variable Type Len Format Label
1 Effect Char 9
2 Dependent Char 8
3 trt Char 1
4 LSMean Num 8 12.8 y LSMEAN
5 LSMeanNumber Num 8 BEST8. LSMEAN Number
The SAS System 118
06:16 Monday, March 15, 2010
LSMean
Obs Effect Dependent trt LSMean Number
1 trt y 1 0.54560722 1
2 trt y 2 0.87772021 2
3 trt y 3 0.31259905 3
The SAS System 119
06:16 Monday, March 15, 2010
The CONTENTS Procedure
Variables in Creation Order
# Variable Type Len Format Label
1 Effect Char 9
2 Dependent Char 8
3 trt Char 1
4 LowerCL Num 8 D12.3
5 LSMean Num 8 D12.3 y LSMEAN
6 UpperCL Num 8 D12.3
The SAS System 120
06:16 Monday, March 15, 2010
Obs Effect Dependent trt LowerCL LSMean UpperCL
1 trt y 1 0.243535 0.545607 0.847680
2 trt y 2 0.575648 0.877720 1.179793
3 trt y 3 0.010527 0.312599 0.614671
The SAS System 121
06:16 Monday, March 15, 2010
The CONTENTS Procedure
Variables in Creation Order
# Variable Type Len Format Label
1 Effect Char 9
2 Dependent Char 8
3 i Num 8 1.
4 j Num 8 1.
5 LowerCL Num 8 D12.3
6 Difference Num 8 D12.3 Difference Between Means
7 UpperCL Num 8 D12.3
The SAS System 122
06:16 Monday, March 15, 2010
Obs Effect Dependent i j LowerCL Difference UpperCL
1 trt y 1 2 -0.759308 -0.332113 0.095082
2 trt y 1 3 -0.194187 0.233008 0.660203
3 trt y 2 3 0.137926 0.565121 0.992316
[/pre]