我正在使用select创建一个宏数组
proc sql;
select numValue into:num_value separated by ' ' from tableA;
quit;
%put %scan(num_value,1);但是,宏num_value中的值不会按照其原始顺序(从小到大)排列它们的数值。
那么,我如何根据索引对它们的值进行降序或升序排列,或者宏数组与原始表具有相同的顺序。
谢谢!
发布于 2018-03-06 09:42:38
如果我没理解错你的问题,你想在宏变量中排序值,你可以这样做:
proc sql;
select height into:height from sashelp.class order by height;
quit;
%put &height;发布于 2018-03-06 18:03:11
代码:下面的值按降序排序,如果不指定,则默认顺序为升序。
proc sql;
select height into:height separated by ' ' from sashelp.class order by height desc;
quit;
%put &height;日志:
72 69 67 66.5 66.5 65.3 64.8 64.3 63.5 62.8 62.5 62.5 59.8 59 57.5 57.3 56.5 56.3 51.3输出:

https://stackoverflow.com/questions/49121954
复制相似问题