sas如何获取某个变量的第一个和最后一个值
1个回答
展开全部
proc sql;
select name into:first_name from (select monotonic() as num,* from sashelp.class) having num=min(num);
select name into:last_name from (select monotonic() as num,* from sashelp.class) having num=max(num);
quit;
or data step
data _null_;
set sashelp.class end=last;
if _n_=1 then call symputx('first_name',name);
if last then call symputx('last_name',name);
run;
%put& first_name& last_name;
select name into:first_name from (select monotonic() as num,* from sashelp.class) having num=min(num);
select name into:last_name from (select monotonic() as num,* from sashelp.class) having num=max(num);
quit;
or data step
data _null_;
set sashelp.class end=last;
if _n_=1 then call symputx('first_name',name);
if last then call symputx('last_name',name);
run;
%put& first_name& last_name;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |