Daniel Jennings
Daniel Jennings

Reputation: 1

SAS- Newcomer having getting proc freq to show 1 before 0

I am trying to use ProcFreq to calculate sensitivity and specificity where 1 is my outcome. I need to get 1 in the upper left and 0 in the lower right. I have tried sorting but it didn't change. I would appreciate any suggestions.

The code I am trying:

proc sort data=genes3;
     by descending A62 descending status2;
         run;

Proc Freq data=genes3;
Tables A62*Status2/ senspec;
run; 

Screenshot of the results I am getting.Results

Upvotes: 0

Views: 358

Answers (1)

data _null_
data _null_

Reputation: 9109

I think all you need to add is ORDER=DATA to PROC FREQ statement. You have the right idea with descending sort.

data genes3;
   do A62=0,1;
      do status2=0,1;
         input f @;
         output;
         end;
      end;
   cards;
4 1 3 9
   run;

proc sort data=genes3;
   by descending A62 descending status2;
   run;
proc print;
   run;
Proc Freq data=genes3 order=data;
   Tables A62*Status2;
   weight f;
   run; 

enter image description here

Upvotes: 1

Related Questions