首页 > 解决方案 > SAS-新手让 proc freq 在 0 之前显示 1

问题描述

我正在尝试使用 ProcFreq 来计算灵敏度和特异性,其中 1 是我的结果。我需要在左上角得到 1,在右下角得到 0。我试过排序,但没有改变。我将不胜感激任何建议。

我正在尝试的代码:

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

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

我得到的结果的屏幕截图。结果

标签: sas

解决方案


我认为您需要添加的只是 ORDER=DATA 到 PROC FREQ 语句。你对降序有正确的想法。

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; 

在此处输入图像描述


推荐阅读