利用Sort过程或者SQL过程中的Order by就很容易做到,具体代码如下:
options nodate pageno=1 ls=64 ps=80;
/*Produce the Original Data*/
data raw_data;
length brand $ 1;
input brand $ price@@;
datalines;
a 1 b 2 c 0.5 d 1.5
;
run;
/*Method 1 - Sorted the data by Price Ascendingly Using Proc Sort*/
proc sort data=raw_data out=sort_data;
by price;
run;
/*Method 2 - Sorted the data by Price Ascendingly Using Proc SQL*/
proc sql;
create table sort_data2 as
select brand, price
from raw_data
order by price;
quit;
/*Listing the Sorted Data*/
proc print data=sort_data n="The Number of Observations is:";
id brand;
var price;
title "Listing Original Data Sorted by Price Ascendingly";
run;
<p>sas中的菜单功能不是很强大,主要是使用命令。</p> <p>例如</p> <p>data b;<br>set maps.afghani2;<br>by 价格;<br>run;</p> <p>这其实都是一些简单的命令,人大经济论坛很多大牛,可以进去看看,网址:</p> <p><a
标签更多>>
专题更多>>
最新文章更多>>
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源
- 使用 C# 6.0 功能运行 TFS 构建
森屿暖树Autism