My collegue and I are calculating summary statistics using two different methods. We don't understand why the results of BASE_VALUE are not the same. Both procedures present the standard deviation 0.005 but after performing the the put function below, the PROC MEANS StDev = 0.01 while PROC UNIVARIATE StDev = 0.00. I have determined that the Hex Values are not the same but I don't know why or which value is more correct. Any help or insight is much appreciated! Thanks!! strip(PUT(COL1,8.2)) data test ;
INPUT VALUE 8. ;
DATALINES ;
0.12
0.12
0.12
0.11
;
RUN ;
* Proc Means ;
proc means data = test noprint ;
var VALUE ;
output out = proc_mean mean = MeanS std = StdDevS min = MinS max = MaxS n = nS median = MedianS ;
run ;
* Proc univariate ;
proc univariate data = test noprint ;
var VALUE ;
output out = proc_univ mean = MeanS std = StdDevS min = MinS max = MaxS n = nS median = MedianS ;
run ;
* Transpose both ;
proc transpose data = proc_mean out= proc_mean2 ; run ;
proc transpose data = proc_univ out= proc_univ2 ; run ;
* Proc means data - Round to 2dp, determine hex value, and print ;
data proc_mean2 ;
set proc_mean2 ;
if _NAME_ in('STDDEVS') then do;
BASE_VALUE = strip(PUT(COL1,8.2)) ;
HEX_VALUE = put(COL1,HEX16.) ;
end ;
proc print ;
var _NAME_ COL1 BASE_VALUE HEX_VALUE ;
WHERE _NAME_ = 'STDDEVS' ;
RUN ;
* Proc univariate data- Round to 2dp, determine Hex value, and print ;
data proc_univ2 ;
set proc_univ2 ;
if _NAME_ in('STDDEVS') then do;
BASE_VALUE = strip(PUT(COL1,8.2)) ;
HEX_VALUE = put(COL1,HEX16.) ;
end ;
proc print ;
var _NAME_ COL1 BASE_VALUE HEX_VALUE ;
WHERE _NAME_ = 'STDDEVS' ;
RUN ;
... View more