楼主: caibloodhoof
2386 6

[原创博文] 请教一个有关SAS中宏的问题 [推广有奖]

  • 0关注
  • 0粉丝

已卖:667份资源

大专生

6%

还不是VIP/贵宾

-

威望
0
论坛币
9855 个
通用积分
23.2253
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
229 点
帖子
19
精华
0
在线时间
55 小时
注册时间
2008-1-6
最后登录
2020-6-10

楼主
caibloodhoof 发表于 2012-8-5 17:59:56 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
各位,在下遇到一个有关宏的问题解决不了,故前来请教各路高手。问题如下:

先上程序:

%let _pgm=tcon020;

%macro report(data=);

     %if &data in (&_pgm._1_1,&_pgm._1_3) %then %do;
         %put "the table outputed is table1";
     %end;
     %else if &data in (&_pgm._1_2,&_pgm._1_4) %then %do;
         %put "the table outputed is table2";
     %end;

%mend report;

%report(data=&_pgm._1_1)

程序报错,提示为: ERROR: 需要的操作符在以下表达式中没有找到: &data in (&_pgm._1_1,&_pgm._1_3)
                                 ERROR: 宏 REPORT 将终止执行。

本人将程序改成了

%let _pgm=tcon020;
%macro report(data=);

     %if &data=&_pgm._1_1 or &data=&_pgm._1_3 %then %do;
         %put "the table outputed is table1";
     %end;
     %else if &data=&_pgm._1_2 or &data=&_pgm._1_4 %then %do;
         %put "the table outputed is table2";
     %end;

%mend report;

%report(data=&_pgm._1_1)

程序正常运行。

所以请教高手,难道在宏中,”IN'这个 statement不用能?我试过在”IF‘宏环境中能用,难道只有在“%IF"宏环境中无法使用?
请教为什么及除了改用”=“号外的好的解决办法,谢谢各位!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:statement Statemen Report output Statem report 表达式 ERROR 程序

沙发
~~梦~~ 学生认证  发表于 2012-8-5 18:45:57
看标题还以为是中宏呢,进来一看果然不懂。。。

藤椅
novice505 发表于 2012-8-5 19:32:07
这个IN算符只有在SAS9.2及以后版本中才好用

板凳
caibloodhoof 发表于 2012-8-5 23:56:46
novice505 发表于 2012-8-5 19:32
这个IN算符只有在SAS9.2及以后版本中才好用
Sas 9.2中能用了?明天去公司试验下。。。谢谢哦

报纸
changweijiadao 发表于 2012-8-6 10:30:31
in 里面的东西你加个括号看一下

地板
caibloodhoof 发表于 2012-8-7 20:47:53
问题已解决,谢谢各位的关注,有兴趣的朋友可以参考该贴
https://bbs.pinggu.org/thread-690356-1-1.html

7
reduce_fat 发表于 2012-8-8 05:00:38
The question is too complicated to me.
复制粘贴积分链接 https://bbs.pinggu.org/ext8_airdrop.php?airdropfrom^^uid=2669999

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-1 23:42