评论用于测试的代码部分

时间:2012-08-17 19:16:45

标签: debugging comments sas

出于调试目的,我想在SAS程序的第26行之后注释掉所有内容。 endsas终止包括SAS程序在内的所有内容,但我希望程序保留并检查结果。请告知步骤。

3 个答案:

答案 0 :(得分:3)

来自@ RosaryGuy的好答案:

* anything between an asterisk and semicolon will be commented out;

/* anything between a slash-asterisk and asterisk-slash will be commented out */

%macro ignore;

This whole section, between '%macro ignore;' and '%mend;',
including any comments of any kind, any other macro calls, 
and any syntactically incorrect code etc. will be compiled 
at execution time but never run. You should use this to 
'comment out' large sections of code that may already have 
comments in them.

%mend;

答案 1 :(得分:2)

A couple of thoughts:

1) Hold down 'control key and forward slash to comment out line by line.
2) Put code between %macro somename and %Mend

Do not use endsas unless you want to instantly shut down your session.

I hope this helps.

答案 2 :(得分:1)

对于这个稍微不同的问题(In SAS, what are good techniques/options for catching syntax errors?),已接受的答案(由cmjohns提供)包含了评论代码的所有可能方式。

这包括通过以下方式进行:

  • Comments - 两种
  • %include陈述
  • %macro陈述
  • noexeccancel语句
  • options obs=0 noreplace; - 链接的PDF中未涵盖此内容,但问题
  • 中对此进行了介绍

它还包含上述每种方法的方便提示和快捷方式。

详细信息位于this PDF

的链接中