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

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

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

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:

确定