6/20/2011

Why SAS is so tedious

I was just trying to add a reference line to the normal qqplot but why it is so tedious to do so in SAS? I have to calculate the mean and standard deviation of the data. Then save them to a temporary dataset. Then use the data procedure to read this mean/std data and assign them to two macros. Finally, I can use the macros to  set the mean and std of the reference normal line........I believe there is a better way...I need to find out.

While, it is so easy in R. Just type in qqnorm() and qqline() will give you a pretty attractive qqplot. (well, not as beautiful as SAS graphic, but since we have ggplot2........)



DATA class;
INPUT Score @@;
datalines;
56 78 84 73 90 44 76 87 92 75
85 67 90 84 74 64 73 78 69 56
87 73 100 54 81 78 69 64 73 65
;
ODS GRAPHICS ON;

proc means data = class;
output out = statdata mean(score) = mu stddev(score) = sigma;
data _null_;
set statdata;
call symput("mu", mu);
call symput("sigma",sigma);
proc univariate data = class;
HISTOGRAM Score/NORMAL;
QQPLOT Score /NORMAL(mu = &mu sigma = &sigma color = red);
run;

No comments: