Date: Wed, 26 Mar 2008 10:50:34 -0400
Reply-To: Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject: Re: assign macro statement to macro variable
On Wed, 26 Mar 2008 09:40:11 -0500, data _null_, <datanull@GMAIL.COM> wrote:
>I tested this...
>
>227 %MACRO DO_IT;
>228
>229 %let check = %nrstr(%if &sqlrc GT 0 %THEN %GOTO mexit) ;
>230
>231 proc sql;
>232 create table test as
>233 select * from sashelp.class;
>234 quit;
>235
>236 %unquote(&check)
>237
>238 proc print;
>239 run;
>240
>241
>242 %mexit:
>243 %MEND do_it;
>244
>245 options mprint mlogic;
>246 %do_it;
>MLOGIC(DO_IT): Beginning execution.
>MLOGIC(DO_IT): %LET (variable name is CHECK)
>MPRINT(DO_IT): proc sql;
>MPRINT(DO_IT): create table test as select * from sashelp.class;
>NOTE: Table WORK.TEST created, with 19 rows and 5 columns.
>
>MPRINT(DO_IT): quit;
>NOTE: PROCEDURE SQL used (Total process time):
> real time 0.00 seconds
> cpu time 0.00 seconds
>
>
>ERROR: The %IF statement is not valid in open code.
>MPRINT(DO_IT): run;
>MLOGIC(DO_IT): Ending execution.
>
>I was told I'm no macro expert but don't statements like %IF and %DO
>etc have to be compiled.
hi, data _null_,
absolutely. i was wrong. thank you for correcting my mistake.
cheers,
chang
|