楼主: 3qsir
3850 3

[有偿编程] The Macro :Can de bug it? [推广有奖]

  • 2关注
  • 1粉丝

副教授

52%

还不是VIP/贵宾

-

威望
0
论坛币
13606 个
通用积分
3.0000
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
71839 点
帖子
368
精华
0
在线时间
931 小时
注册时间
2011-5-18
最后登录
2021-3-6

30论坛币
Can de bug it ? (Why can  not export to ecxel file after  Proc Model )
Thanks!
I construct a macro program under Intheangel’s given codes,
because I have lots of “a” file : totala1(start)---->totala135(end)
             lots of   “d” file : totald1(start)---->totald135(end)
I hope all results of “afters” file : after1(start)---->after135(end)

------------------------------------------------------------
%macro country(cstart,cend)
%Do i=&cstart %to &cend;
procimportdatafile=”c:\temp\toatala.&i.csv”
out=a.&i
         dbms=csv
         replace;
getnames=no;
run;
procimportdatafile=”c:\temp\toatalb.&i.csv”
out=d.&i
         dbms=csv
         replace;
getnames=no;
run;
PROCMODEL DATA= a.&i ;
          y=a0+a1*x;
by group;
FIT y / OUTEST=b.&i ;
SOLVE y / DATA=d.&i ESTDATA=b.&i OUT=c.&i ;
BY group;
RUN;
Data cc.&i(keep=month group y);
Merge d.&i c.&i;
by group;
run;
proctranspose data=cc.&I out=after.&i(drop=_name_);
by group;
id month;
procexport data= after&i
outfile="c:\temp\after&i.csv"
dbms=csv
replace;
run;
%end;
%mend country;

关键词:Macro acr bug CRO The because country start file
沙发
intheangel 学生认证  发表于 2014-3-13 19:51:13 |只看作者 |坛友微信交流群
%macro country(cstart,cend);
%Do i=&cstart. %to &cend.;
proc import datafile=”c:\temp\toatala.&i.csv”
out=a.&i
         dbms=csv
         replace;
getnames=no;
run;
proc import datafile=”c:\temp\toatalb.&i.csv”
out=d.&i
         dbms=csv
         replace;
getnames=no;
run;
PROCMODEL DATA= a.&i ;
          y=a0+a1*x;
by group;
FIT y / OUTEST=b.&i ;
SOLVE y / DATA=d.&i ESTDATA=b.&i OUT=c.&i ;
BY group;
RUN;
Data cc.&i(keep=month group y);
Merge d.&i c.&i;
by group;
run;
proc transpose data=cc.&I out=after.&i(drop=_name_);
by group;
id month;
proc export data= after&i
outfile="c:\temp\after&i.csv"
dbms=csv
replace;
run;
%end;
%mend country;



SAS can not de bug as others, you lost a ';' after the %macro country(cstart,cend)
我是一只瘦瘦的小猪~~~
╭︿︿︿╮
{/-◎◎-/}
( (oo) )
  ︶︶︶

使用道具

藤椅
3qsir 发表于 2014-3-14 10:37:36 |只看作者 |坛友微信交流群
NOT GOOD (bug)!
very trouble , there are confuse for me !
8          ODS _ALL_ CLOSE;
9          OPTIONS DEV=ACTIVEX;
NOTE: Procedures may not support all options or statements for all devices. For details,
      see the documentation for each procedure.
10         GOPTIONS XPIXELS=0 YPIXELS=0;
11         FILENAME EGSR TEMP;
12         ODS tagsets.sasreport12(ID=EGSR) FILE=EGSR STYLE=Analysis
12       ! STYLESHEET=(URL="file:///C:/Program%20Files/SAS/EnterpriseGuide/4.3/Styles/Analy
12       ! sis.css") NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation ENCODING=UTF8
12       ! options(rolap="on");
NOTE: Writing TAGSETS.SASREPORT12(EGSR) Body file: EGSR
13         
14         GOPTIONS ACCESSIBLE;
15         %macro country(cstart,cend);
16          %Do i=&cstart. %to &cend.;
17          proc import datafile=”c:\temp\toatala.&i.csv”
18          out=a.&i
19                   dbms=csv
20                   replace;
21          getnames=no;
22          run;
23          proc import datafile=”c:\temp\toatalb.&i.csv”
24          out=d.&i
25                   dbms=csv
26                   replace;
27          getnames=no;
28          run;
29          PROCMODEL DATA= a.&i ;
30                    y=a0+a1*x;
31          by group;
32          FIT y / OUTEST=b.&i ;
33          SOLVE y / DATA=d.&i ESTDATA=b.&i OUT=c.&i ;
34          BY group;
35          RUN;
36          Data cc.&i(keep=month group y);
37          Merge d.&i c.&i;
38          by group;
39          run;
40          proc transpose data=cc.&I out=after.&i(drop=_name_);
41          by group;
42          id month;
43          proc export data= after&i
44          outfile="c:\temp\after&i.csv"
45          dbms=csv
46          replace;
47          run;
48          %end;
49          %mend country;
50          %country(1,1)
      
NOTE: The SAS System stopped processing this step because of errors.
NOTE: Line generated by the invoked macro "COUNTRY".
2                                    

50           proc import datafile=”c:\temp\toatala.&i.csv”  out=a.&i           dbms=csv
                                     _
                                     22
                                     76
50       !          replace;  getnames=no;  run;  proc import
50       ! datafile=”c:\temp\toatalb.&i.csv”  out=d.&i           dbms=csv
50       ! replace;  getnames=no;  run;  PROC MODEL DATA= a.

22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE
              and COLUMN where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: ;, DATAFILE, DATATABLE, DBMS,
              DEBUG, FILE, OUT, REPLACE, TABLE, _DEBUG_.  
ERROR 22-322: Syntax error, expecting one of the following: ;, DATAFILE, DATATABLE, DBMS,
              DEBUG, FILE, OUT, REPLACE, TABLE, _DEBUG_.  

ERROR 76-322: Syntax error, statement will be ignored.

76: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE and COLUMN
      where the error has occurred.
ERROR 76-322: Syntax error, statement will be ignored.
      
NOTE: The SAS System stopped processing this step because of errors.

22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE
              and COLUMN where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, /, ;,
              _DATA_, _LAST_, _NULL_.  
201: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE and COLUMN
      where the error has occurred.
ERROR 201-322: The option is not recognized and will be ignored.
22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE
              and COLUMN where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, /, ;,
              _DATA_, _LAST_, _NULL_.  
76: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE and COLUMN
      where the error has occurred.
ERROR 76-322: Syntax error, statement will be ignored.
NOTE: Line generated by the macro variable "I".
50          d.1
            ___
            22
            201

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;,
              END, _DATA_, _LAST_, _NULL_.  

ERROR 201-322: The option is not recognized and will be ignored.

NOTE: The SAS System stopped processing this step because of errors.
      

ERROR: Libname CC is not assigned.
3                                   

ERROR: Libname AFTER is not assigned.

NOTE: The SAS System stopped processing this step because of errors.
      
ERROR: File WORK.AFTER1.DATA does not exist.
ERROR: Export unsuccessful.  See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
      
51         
52         
53         
54         GOPTIONS NOACCESSIBLE;
55         %LET _CLIENTTASKLABEL=;
56         %LET _CLIENTPROJECTPATH=;
57         %LET _CLIENTPROJECTNAME=;
58         %LET _SASPROGRAMFILE=;
59         
60         ;*';*";*/;quit;run;
61         ODS _ALL_ CLOSE;
62         
63         
64         QUIT; RUN;
65         

使用道具

板凳
jeozu 发表于 2014-5-21 18:00:48 |只看作者 |坛友微信交流群
proc import datafile=”c:\temp\toatala.&i.csv” ==>
  1. proc import datafile=”c:\temp\toatala.&i..csv”
复制代码

and the others the same.

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-28 21:31