Hi,
Rather embarrassingly, I produced a draft report for a client, who immediately spotted that something was wrong. It took me an hour to find a "fix", but I'm worried that this problem arose in the first place. The data were calculated scores from a questionnaire given repeatedly (and at fixed but unequal intervals) to subjects; the example below uses a different dataset, bit illustrates the problem.
/* Examples illustrating PROC SGPLOT overlay problem */;
data forplot ;
set sashelp.bmimen ;
If Age < 20 then delete; /* simplify the dataset */
agedec = 10*int(Age/10); /* calculate age decade */
run;
title3 'BMI in men by age group';
proc means data=forplot maxdec=2 min max median q1 q3 ;
var BMI;
class agedec ;
run;
title3 'BMI in men by age group - discrete xaxis';
proc sgplot data=forplot noautolegend;
vbox BMI / category=agedec ;
scatter x=agedec y=BMI / jitter;
xaxis type=discrete ;
label agedec = 'Age decade' BMI="Body Mass Index" ;
run;
title3 'BMI in men by age group - time xaxis';
proc sgplot data=forplot noautolegend;
vbox BMI / category=agedec ;
scatter x=agedec y=BMI / jitter;
xaxis type=time ;
label agedec = 'Age decade' BMI="Body Mass Index" ;
run;
Why is the plot using a discrete axis so different from a plot using a time axis? Even more alarmingly, why are there two men in their 20s with BMI > 40 in the first plot, but four such men in the second plot!?!
Two men with BMI > 40 have appeared out of thin air?!?
... View more