Q would the name of the variable you are using to restrict records to those with a value of 1. I would have to assume the 1 means something specific in terms of your process.
You do not need to use order=formatted. That might change the order of display of the variable Gold in the result tables. The default order is internal, which would be the sort order of the underlying values of a variable.
@MKar wrote:
Hi,
I am doing a diagnostic test accuracy study for a screening test versus the gold standard. I have searched codes for performing sensitivity and specificity and PPV and NPV. I have used this macro to get sen and spec and PPV and NPV.
/*for sensitivity*/
ods rtf; ods listing close;
%macro se (q);
proc freq data=DATA order= formatted;
where &q =1;
tables gold / binomial(level='yes');
exact binomial;
title "Specificity/ exposure as test/variables as response" &q; run;
%mend sp;
%se (variable1);
%se (variable2);
run; ods rtf close; ods listing; quit; run;
3- Why for variable1 sas calculated all records in my data but for variable2 sas used only part of data. It means that table of frequency "yes no" and cumulative frequency are not the same. For variable1 cumulative is correct (total of yes no) but for variable2 cumulative is only for (yes). I think the analysis is not right for variable2.
Thank you for you help.
The variable you are passing to the macro SE is used to select records. It will only process those where the value of the variable=1.
So "correctness" depends on the content of your data and the actual intended analysis. It may be that your variable2 has values of 1 only when (gold?) has values of yes. Interpretation depends on what you have set up.