SAS错误:检测到开放代码语句递归

huangapple go评论86阅读模式
英文:

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:

  1. 在以下代码中出现错误消息:
  2. %let start=1;
  3. %let end=6;
  4. %global i;
  5. %put 注意:&start, &end;
  6. /*打印 i*/
  7. %do i=&start %to &end;
  8. %put 注意:&i
  9. %end;
英文:

Just getting an error msg on the following code:

  1. %let start=1;
  2. %let end=6;
  3. %global i;
  4. %put note: &start, &end;
  5. /*Print i*/
  6. %do i=&start %to &end;
  7. %put note: &i
  8. %end;

答案1

得分: 1

你的循环中缺少一个分号:%put note: &i;。你还需要将循环封装在一个宏内。以下是修正后的代码:

  1. %macro loop;
  2. %let start=1;
  3. %let end=6;
  4. %global i;
  5. %put note: &start, &end;
  6. /*打印i*/
  7. %do i=&start %to &end;
  8. %put note: &i;
  9. %end;
  10. %mend;
  11. %loop;
英文:

You're missing a semicolon in your loop: %put note: &i;. You also need to encapsulate your loop within a macro.

  1. %macro loop;
  2. %let start=1;
  3. %let end=6;
  4. %global i;
  5. %put note: &start, &end;
  6. /*Print i*/
  7. %do i=&start %to &end;
  8. %put note: &i;
  9. %end;
  10. %mend;
  11. %loop;
  1. note: 1, 6
  2. note: 1
  3. note: 2
  4. note: 3
  5. note: 4
  6. note: 5
  7. note: 6

huangapple
  • 本文由 发表于 2023年5月23日 01:26:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76308614.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定