arrays - SAS Do Over Macro - Backwards -


i using macro arrays , on macro.

i rewrite code on macro:

if mysequence > 4 grammar_last_5 = grammar_last_4; if mysequence > 3 grammar_last_4 = grammar_last_3; if mysequence > 2 grammar_last_3 = grammar_last_2; if mysequence > 1 grammar_last_2 = grammar_last_1; 

so on like:

%do_over(values=2-5, phrase= if mysequence > %eval(6-?) grammar_last_%eval(7-?) = grammar_last_%eval(6-?);) 

but doesn't work.

does know how can done?

thanks!! adam

for others wondering, macros appear available here: http://www.sascommunity.org/wiki/tight_looping_with_macro_arrays

you've got problem though. you're trying pass in %eval(6-?) , other functions text %do_over macro. going try compute function , pass result macro, , because finding character in should mathematical operation, i'm guessing subsequently throwing bit of tantrum.

what's more, way want doesn't seem forthcoming, because you'd need mask function macro compiler you're feeding in argument, unmask macro compiler being used do_over, , i'm guessing do_over isn't going understand want without rewriting logic if succeeded.

may humbly suggest own macro code starting solution. like:

%do = 5 %to 2 %by -1;  if mysequence > %eval(&i - 1) grammar_last_&i = grammar_last_%eval(&i - 1); %end; 

this should produce text want, though need put in own macro, , call in data step, wouldn't make sense anywhere else.

if you're going want more generalized, you're going have hands much messier...


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -