如题,The SAS data set Sashelp.Prdsale contains the variables Region and Salary with 4 observations per Region. Sashelp.Prdsale is sorted primarily by Region and within Region by Salary in descending order,以下
是程序:
data one;
set sashelp.prdsale;
retain temp;
by region descending salary;
if first.region then
do;
temp=salary;
output;
end;
if last.region then
do;
range=salary-temp;
output;
end;
run;
那么请问,最后在OUTPUT DATASET中应该是first和last两个观测值还是first到last一共四个观测值啊???如果是两个观测值的话怎样改这个程序才可以变成四个观测值啊????谢谢啦