New Contributor
Posts: 2

# How do I calculate diagnostic performance of a test with 95% confidence interval?

I have a binary dependent variable (pathology:benign=0, malignant=1) and a binary independent variable (ACR01: 0 and 1). I want to calculate the diagnostic performance of this diagnostic test (ACR01: 0 and 1) with 95% confidence interval. I am using SAS university edition. My example data is FNA.xlsx.

How much appreciated!

``````libname rjl "/folders/myfolders/";
run;
/** Import an XLSX file.  **/

PROC IMPORT DATAFILE="/folders/myfolders/FNA.xlsx"
OUT=rjl.FNA
DBMS=XLSX
REPLACE;
RUN;

/** Print the results. **/

PROC PRINT DATA=rjl.FNA;
RUN;data rjl.diagnosticperformance;
set rjl.fna;
array acr01(i);
array pathology(i);
a=0;b=0;c=0;d=0;
do i= 1 to 1001;
if acr01(i)=1 and pathology(i)=1 then a=a+1;
if acr01(i)=1 and pathology(i)=0 then b=b+1;
if acr01(i)=0 and pathology(i)=1 then c=c+1;
if acr01(i)=0 and pathology(i)=0 then d=d+1;
end;
sensitivity=a/(a+c);/*敏感性*/
specificity=d/(b+d);/*特异性*/
beta=c/(a+c);/*漏诊率*/
alfa=b/(b+d);/*误诊率*/
pLR=se/af;/*阳性似然比*/
nLR=beta/sp;/*阴性似然比*/
YI=(a/(a+c)+d/(b+d))-1;/*约登指数*/
pPV=a/(a+b);/*阳性预告值*/
nPV=d/(c+d);/*阴性预告值*/
p0=(a+b)/(a+b+c+d);/*观察符合率*/
pc=((a+c)*(a+b)/(a+b+c+d)+(b+d)*(c+d)/(a+b+c+d))/(a+b+c+d);/**/
k=(p0-pc)/(1-pc);/*卡帕值*/
output ;
run;``````

log1log2

Super User
Posts: 13,941

## Re: How do I calculate diagnostic performance of a test with 95% confidence interval?

Best is to copy and paste log results and error messages into a code box opened using the forums {I} menu icon to preserve the formatting of the error messages.

```RUN;data rjl.diagnosticperformance;
set rjl.fna;
array acr01(i);
array pathology(i);
```

Your array definitions use a variable to assign the number of elements. That is not valid syntax. You either need to explicitly place a numeral in the array definition OR list existing variables. If your existing variables have a common stem to the name with a numeric suffix you could use definitions like

```array acr01 acrname1-acrname1001;
/*or*/
array acr01 acrname: ;```

If you use

`array acr01(1001);`

and variable acr011 acr012 ... arc011001 then those variables can be referenced by the array.

I am not going to open a spreadsheet, especially one that may have 1000s of columns(???) to see what your data looks like as a SPREADSHEET is NOT a SAS data set.

Either post some example data in the form of data step code or proc contents so we can at least see the actual names of your existing variables.

Discussion stats