1
我是初学SAS编程人员。 我已经写了一段代码来理解这些东西,但是我没有得到为什么在得到continue语句之后它将输出一个语句。 下面给出的是代码:后端处理SET语句以及在SAS中使用Continue和Leave语句
data a B;
put 'entering do DATASTEP' ;
do i=1 to 4;
put 'entering do loop'" " i;
if (i=1) then do;
put 'value of i is 1'" " i;
put 'Entering the loop' ;
put j=_N_;
if _N_ = 2 then continue;
set sashelp.class(firstobs=1 obs=5);
put 'Ouside the loop';
output a;
end;
if (i=2) then do;
put 'value of i is 2'" " i;
put 'Entering the loop' ;
put j=_n_;
set sashelp.class(firstobs=6 obs=10);
put 'Ouside the loop';
output B;
end;
end;
put 'GETING OUT OF THE DATASTEP';
run;
有关我的疑问请求。请运行这更清晰,那么我们就可以有一个关于输出数据集和日志的讨论。
在此先感谢。
你是怎么编写你不明白的代码的?你到底想要做什么? – Cristina
感谢克里斯蒂娜的回应。我不想从这些代码中获得任何要求。我只是想了解输出是如何生成到两个数据集中的,以及为什么Continue Statement没有按照其规范工作。据我说,在数据集A中应该只有4条记录,因为我已经使用了_N_ = 2的继续声明,但是我得到了5条记录。第二条记录不应进入数据集A,因为continue语句在输出A之前。请让我知道,如果您遇到我的问题。 –
啊哈,好的!感谢您的澄清 - 您可以将这些信息添加到您的帖子中,以使其更易于理解。 – Cristina