英文:
SAS Error: Open Code Statement Recursion detected
问题
I am your Chinese translator, and I will only provide translations for the code portion you provided. Here's the translated code:
在以下代码中出现错误消息:
%let start=1;
%let end=6;
%global i;
%put 注意:&start, &end;
/*打印 i*/
%do i=&start %to &end;
%put 注意:&i
%end;
英文:
Just getting an error msg on the following code:
%let start=1;
%let end=6;
%global i;
%put note: &start, &end;
/*Print i*/
%do i=&start %to &end;
%put note: &i
%end;
答案1
得分: 1
你的循环中缺少一个分号:%put note: &i;
。你还需要将循环封装在一个宏内。以下是修正后的代码:
%macro loop;
%let start=1;
%let end=6;
%global i;
%put note: &start, &end;
/*打印i*/
%do i=&start %to &end;
%put note: &i;
%end;
%mend;
%loop;
英文:
You're missing a semicolon in your loop: %put note: &i;
. You also need to encapsulate your loop within a macro.
%macro loop;
%let start=1;
%let end=6;
%global i;
%put note: &start, &end;
/*Print i*/
%do i=&start %to &end;
%put note: &i;
%end;
%mend;
%loop;
note: 1, 6
note: 1
note: 2
note: 3
note: 4
note: 5
note: 6
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论