我在SAS中的表(Total)中的各列中有数据,如下所示:
columnA ColumnB ColumnC ColumnD
20 30 10 50
我想按照值的降序对列进行排序。即输出应如下:
columnD ColumnB ColumnA ColumnC
50 30 20 10
如何在SAS代码中获得上述输出?
答案 0 :(得分:0)
你去:
data old;
a=20;
b=30;
c=10;
d=50;
run;
proc transpose data = old out=tran;
var _all_;
run;
proc sort data=tran out = sort;
by descending col1 ;
run;
proc transpose data = sort out=new (drop=_NAME_);
var col1;
id _NAME_;
run;