SAS中文论坛

标题: 求助:为什么每次用by语句都会出错? [打印本页]

作者: shiyiming    时间: 2009-2-19 10:00
标题: 求助:为什么每次用by语句都会出错?
请问为什么每次用by语句都会出错?程序及错误如下。谢谢!
140  proc print data=resdat.class;
141
142  by sex;
143
144  run;

[color=#FF0000:gtozyc3x]ERROR: [/color:gtozyc3x]Data set RESDAT.CLASS is not sorted in ascending sequence. The current by-group has Sex = M
       and the next by-group has Sex = F.
作者: shiyiming    时间: 2009-2-19 17:51
标题: Re: 求助:为什么每次用by语句都会出错?
That is because you did not sort the data set by variable 'sex' before you use a "by sex;" statement in the print procedure.

try to use a sort procedure before print it .

proc sort data=resdat.class;
       by sex;
run;

proc print data=resdat.class;
       by sex;
run;

Then the program will execute successfully.
作者: shiyiming    时间: 2009-2-20 15:16
标题: Re: 求助:为什么每次用by语句都会出错?
To pobel: 问题已解决,谢谢!




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2