楼主: 小鳄鱼a
3894 7

请帮忙看看这段代码哪个地方错了 [推广有奖]

  • 6关注
  • 10粉丝

已卖:280份资源

学科带头人

3%

还不是VIP/贵宾

-

威望
0
论坛币
125 个
通用积分
0.0040
学术水平
40 点
热心指数
45 点
信用等级
43 点
经验
32801 点
帖子
1185
精华
0
在线时间
1539 小时
注册时间
2009-7-16
最后登录
2018-10-5

楼主
小鳄鱼a 发表于 2014-10-29 15:10:19 |AI写论文
10论坛币

%macro calrowcol(dat=);

%let dsid=%sysfunc(open(&dat));  

%let row=%sysfunc(attrn(&dsid,nobs));
%let col=%sysfunc(attrn(&dsid,nvars));

%let rc=%sysfunc(close(&dat));

%put rownum=&row;
%put colnum=&col;


%mend;


最佳答案

pobel 查看完整内容

To recover from this error, you must submit the following: '); %mend; If the above methods do not work, try submitting the following string: *'; *"; *); */; %mend; run; Continue submitting this string until the following message appears in the SAS log: ERROR: No matching %MACRO statement for this %MEND statement.
关键词:sysfunc Close Macro Lose nobs close

沙发
pobel 在职认证  发表于 2014-10-29 15:10:20
To recover from this error, you must submit the following:

');
%mend;

If the above methods do not work, try submitting the following string:

*'; *"; *); */; %mend; run;

Continue submitting this string until the following message appears in the SAS log:

ERROR: No matching %MACRO statement for this %MEND statement.
已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
小鳄鱼a + 5 + 4 + 4 + 4 精彩帖子

总评分: 论坛币 + 5  学术水平 + 4  热心指数 + 4  信用等级 + 4   查看全部评分

藤椅
pobel 在职认证  发表于 2014-10-29 15:14:35
%let rc=%sysfunc(close(&dsid));

板凳
小鳄鱼a 发表于 2014-10-29 15:17:31
pobel 发表于 2014-10-29 15:14
%let rc=%sysfunc(close(&dsid));
5457
5458   %macro calrowcol(dat=);
5459
5460   %let dsid=%sysfunc(open(&dat));
5461
5462   %let row=%sysfunc(attrn(&dsid,nobs));
ERROR: 检测到开型代码语句的递归。
5463   %let col=%sysfunc(attrn(&dsid,nvars));
ERROR: 检测到开型代码语句的递归。
5464
5465   %let rc=%sysfunc(close(&dsid));
ERROR: 检测到开型代码语句的递归。
5466
5467   %put rownum=&row;
ERROR: 检测到开型代码语句的递归。
5468   %put colnum=&col;
ERROR: 检测到开型代码语句的递归。
5469
5470
5471   %mend;
ERROR: 宏关键字 MEND 显示为文本。可能缺失分号或其他分隔符。

报纸
小鳄鱼a 发表于 2014-10-29 15:28:34
pobel 发表于 2014-10-29 15:14
%let rc=%sysfunc(close(&dsid));
程序执行中可能出现了其他问题   

地板
sniperhgy 发表于 2014-10-29 15:34:08
小鳄鱼a 发表于 2014-10-29 15:17
5457
5458   %macro calrowcol(dat=);
5459
宏定义的右括号是中文的……。
请注意观察,看到不一样的地方了吗?
  1. %macro calrowcol(dat=);
  2. %macro calrowcol(dat=);
复制代码
已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
小鳄鱼a + 5 + 4 + 4 + 4 精彩帖子

总评分: 论坛币 + 5  学术水平 + 4  热心指数 + 4  信用等级 + 4   查看全部评分

7
小鳄鱼a 发表于 2014-10-29 15:36:52
pobel 发表于 2014-10-29 15:10
To recover from this error, you must submit the following:

');
太膜拜了   能否解释一下这里面会有啥问题  
有的时候运行了几次宏之后    sas就只能提交语句   但是就是不执行    这是为什么啊   一般用什么方法解决   本来跑完主体程序不容易   需要一个多小时    如果重新启动跑的话 太浪费时间了  

8
pobel 在职认证  发表于 2014-10-29 15:49:42
小鳄鱼a 发表于 2014-10-29 15:36
太膜拜了   能否解释一下这里面会有啥问题  
有的时候运行了几次宏之后    sas就只能提交语句   但是就是 ...
这种问题可以说是大问题,可到了程序里可能只是一个小小的错误。
解决的方法,除了细心外,个人认为还是加强对宏的理解和对潜在问题的警觉。
楼主可以看看帮助文档里“Macro Facility Error Messages and Debugging” 这部分。

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 20:05