From: "Terjeson, Mark" on 6 Nov 2009 14:24 Hi, It may be an unexpected value in one or both of the variables being used. To turn on some debugging to see what is going on you could use the code below and then review the log to see if you can spot any syntax or values that would break your process. e.g. data Client_List; length stmp $256; set cat.wharton_list_0110; by agtnum; if first.agtnum then do; stmp = '%getlist('||agtnum||','||trim(left(agtname))||')'; put stmp=; * uncomment to debug ; ***call execute(stmp); * uncomment to execute ; end; run; Hope this is helpful. Mark Terjeson Investment Business Intelligence Investment Management & Research Russell Investments 253-439-2367 Russell Global Leaders in Multi-Manager Investing -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of cherub Sent: Friday, November 06, 2009 11:14 AM To: SAS-L(a)LISTSERV.UGA.EDU Subject: Macro error help I have a master SAS data which has serveral agents information, I want to split data into small data by each agent and export each small data into Excel. the orginal code is list here, %macro getlist(agtnum,agtname); data agtlist; set cat.wharton_list_0110; where agtnum="&agtnum"; proc export data=agtlist outfile="C\&agtname._&agtnum..xls" dbms=excel2000 replace; run; %mend; data Client_List; set cat.wharton_list_0110; by agtnum; /*format agtname $30.;*/ /*i move this to somewhere ahead*/ if first.agtnum then call execute('%getlist('||agtnum||','||trim(left(agtname))||')'); /*i dropped trim(left( )) around agtnum1 here and added it around agtname.*/ run; However, sometimes it works well, but sometimes i got error like this, ERROR: All positional parameters must precede keyword parameters. ERROR: All positional parameters must precede keyword parameters. ERROR: All positional parameters must precede keyword parameters. ERROR: Macro parameter contains syntax error. ERROR: All positional parameters must precede keyword parameters. Can anybody help with that, thank you very much.
From: Sigurd Hermansen on 6 Nov 2009 14:43 Many oddities in the string that you are using to build a SAS Macro parameter list could introduce extra parameters (e.g., a comma in a name or a decimal number) or cause a string representation of a list to parse as a keyword parameter. The problem likely lies in the Macro call: > %getlist('||agtnum||','||trim(left(agtname))||')') Try formatting the value of the variable agtnum as an integer and compressing agtname in the Data step. With careful control of input, you may be able to avoid what often appear to be random errors. Incidentally, the outfile value should, I believe, have a colon after 'C'. S -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of cherub Sent: Friday, November 06, 2009 2:14 PM To: SAS-L(a)LISTSERV.UGA.EDU Subject: Macro error help I have a master SAS data which has serveral agents information, I want to split data into small data by each agent and export each small data into Excel. the orginal code is list here, %macro getlist(agtnum,agtname); data agtlist; set cat.wharton_list_0110; where agtnum="&agtnum"; proc export data=agtlist outfile="C\&agtname._&agtnum..xls" dbms=excel2000 replace; run; %mend; data Client_List; set cat.wharton_list_0110; by agtnum; /*format agtname $30.;*/ /*i move this to somewhere ahead*/ if first.agtnum then call execute('%getlist('||agtnum||','||trim(left(agtname))||')'); /*i dropped trim(left( )) around agtnum1 here and added it around agtname.*/ run; However, sometimes it works well, but sometimes i got error like this, ERROR: All positional parameters must precede keyword parameters. ERROR: All positional parameters must precede keyword parameters. ERROR: All positional parameters must precede keyword parameters. ERROR: Macro parameter contains syntax error. ERROR: All positional parameters must precede keyword parameters. Can anybody help with that, thank you very much.
|
Pages: 1 Prev: Macro error help Next: what is this and how do I fix it? Proc GMAP |