admin管理员组

文章数量:1313084

I am trying to create a funnel plot in SAS based upon a mean attached to a person. I have looked up and emulated funnel plot code but am getting an error message that I cannot understand regardless of what I look up.

Here is some sample data:

data test_00;
input Name$ avg;

datalines;
Greg 4
Jess 5
Jimmy 5
Sandra 1
Maddie 3
Kyle 2
Eric 5
;
run;

Here is the code I am attempting to run to prepare for the funnel plot:

proc iml;
use test_00;
read all var {name avg};
close test_00;

u=unique(name);
p=ncol(u);
mean= j(p,1); sem= j(p,1); n= j(p,1);
do i= 1 to p;
idx= loc(name=u[i]);
n[i]=ncol(idx);
M = avg[idx];
mean[i]=mean(M);
sem[i]= sqrt(var(M)/n[i]);
end;

y=avg[:];
s=sqrt(var(avg));
print y s[label="StDev"];

n = M( do(0, 50, 1) );
p = {0.001 0.025 0.975 0.999}; 
z = quantile("normal", p);
limits = y + s / sqrt(n) * z;

I get the following error after running the above code:

ERROR: Invocation of unresolved module M.

 statement : ASSIGN at line 1644 column 1

I am confused by this because M is a variable that is created within the DO loop and not a module.

Thank you in advance for helping me through this

本文标签: imlCreate Funnel Plot in SASStack Overflow