个人资料
正文

An example that comment \'*\' will cause problem in SAS MACRO

(2008-07-03 10:29:03) 下一个
'*' and ';' are used together to comment in SAS. However, for SAS MACRO, '%* ;' is the offical comment statement. '/**/' can be used in every place. In some cases, '*;'will work in MACRO. However, it might cause a big problem in some cases. See the following example:

%MACRO plines1;/*Macro for poverty lines/
/*Number of poverty lines to process (-1)*/
/*Also known as, maximum index to poverty line*/
%GLOBAL nline;
%LET nline=4;

/*Indices associated with poverty lines*/
%GLOBAL natl;
%LET natl=0;/*natinal poverty line*/
%GLOBAL food;
%LET food=1;/*food poverty line*/
%GLOBAL extr;
%LET extr=2;/*USAID extremely poverty line*/
%GLOBAL d931;
%LET d931=3;/*$1.08/day 1993 ppp poverty line*/
%GLOBAL d932;
%LET d932=4;/*$2.16/day 1993 ppp poverty line*/

*$3.24/day 1993 ppp poverty line;/*NOTE: This will NOT cause a problem.*/

*%GLOBAL lin_&931._rr_u; /*NOTE: This WILL cause a problem.*/

%*%GLOBAL lin_&931._rr_u;/*NOTE: This will NOT cause a problem*/

/*%GLOBAL lin_&931._rr_u;*/ /*NOTE: This will NOT cause a problem*/

%GLOBAL lin_&d931._rr_u ; /*Poverty line for US$1.08--yearly amount 2004 VN Dong--urban by region*/

%MEND plines1;
%plines1;*Macro for poverty lines;

Conclusion: when '*;' is used to comment a Macro statement inside a Macro program, it causes a problem. when it is used to comment text, it seems to work.


SAS MACRO LANGUAGE: REFERENCE Version 8
*; and %*; are complete statements. They are processed by the tokenizer and cann't contain semicolons or unmatched quotation marks. They are stored as constant text in a compiled macro.
/**/ are not tokenized. They are processed as a string of individual characters. These comments can appear anywher a single blank can appear and can contain semicolons or unmatched quotation marks. SAS comments in the form /**/ are not stored in a compiled macro.
[ 打印 ]
阅读 ()评论 (0)
评论
目前还没有任何评论
登录后才可评论.