3
Q
何时引用宏变量
A
回答
4
当您使用它们代替通常需要引用的硬编码的非宏文本时,您只需引用宏变量 - 通常在proc或数据步骤代码中,例如,
%let text = Hello;
/*You need quotes here*/
data _null_;
put "&text";
run;
/*Otherwise you get an error, because SAS thinks hello is a variable name*/
data _null_;
put &text;
run;
/*If you already have quotes in your macro var, you don't need to include them again in the data step code*/
%let text2 = "Hello";
data _null_;
put &text2;
run;
/*In macro statements, everything is already treated as text, so you don't need the quotes*/
%put &text;
/*If you include the quotes anyway, they are counted as part of the text for macro purposes*/
%put "&text";
/*When you are calling functions via %sysfunc that normally
require a variable name or a quoted string, you don't need quotes*/
%let emptyvar=;
%put %sysfunc(coalescec(&emptyvar,&text));
相关问题
- 1. 何时在引用SAS宏变量时使用双引号
- 2. 一个带变量的宏引用宏
- 3. 宏变量的单引号
- 4. 引用已定义的宏变量
- 5. 连接引用的宏变量
- 6. SAS宏变量+数组索引
- 7. 单引号值来创建宏变量
- 8. Excel VBA引用引号中的宏变量
- 9. Clojure - 如何在宏中引用deftype的变量?
- 10. 宏中的变量
- 11. SAS宏变量的变化
- 12. 引用变量
- 13. 变量引用
- 14. 引用变量
- 15. 引用变量
- 16. SAS定义具有双连字宏变量的%LET宏变量
- 17. 在宏变量定义中使用do循环索引
- 18. 用引号将SAS宏变量赋值给数据步骤var
- 19. 评估包含宏引用的字符串变量
- 20. VB脚本引用从宏定义的变量
- 21. Python如何引用变量
- 22. Javascript:如何检测变量的引用何时发生变化
- 23. 使用变量时不使用索引
- 24. PROC宏中的SAS宏变量
- 25. SPSS宏中的变量标签宏
- 26. 匹配多个变量;使用_n_作为变量时SAS宏做循环
- 27. 如何引用从宏观
- 28. 使用调用执行时的宏变量问题
- 29. 在调用symput()时在同一datastep中使用宏变量?
- 30. 设置变量时使用双引号
好答案。你可能想添加一个'%sysfunc'的例子,这是一个常见的错误。 – Joe
太好了,谢谢 – Victor
@Joe好主意 - 更新。 – user667489