Hi: what is the action that you want to call? Right now, X (which you set to %put value doesn't make sense).
Do you have some idea of what you want the final output of the macro to be?
Or, possibly you want to use CALL EXECUTE:
http://support.sas.com/kb/24/634.html
http://support.sas.com/kb/24/730.html
http://support.sas.com/kb/24/709.html
http://support.sas.com/kb/26/140.html
It's hard to visualize what your macro code is supposed to generate. Do you really want to execute a %put or is there some other statement or command or whole program that you want to invoke or execute? Why not just code the %put in the macro program? I don't get the point of scanning &LVAL and then using &METHOD -- you seem to do the same thing no matter what is in &LVAL. I would have expected some thing like this:
[pre]
%if &value = g_dist %then %do;
%put we want g_dist so we also must want something else;
%let other = wombat;
%end;
%else %if &value ne g_dist %then %do;
%put not g_dist ;
%let other = koala;
%end;
[/pre]
or something like this:
[pre]
%if &value = g_dist %then %do;
proc print data=sashelp.class;
title "value = g_dist";
run;
%end;
%else %if &value ne g_dist %then %do;
proc means data=sashelp.shoes min mean max;
title 'run proc means';
var sales;
run;
%end;
[/pre]
or...something requiring a call execute in a data step.
Also, as a best practice, it's probably best to avoid mixing positional parameters and keyword parameters...so I'd recommend against what you're showing because all the positional parameters have to appear, in the right order, before any of the keyword parameters.
If you review the output from the revised macro program below (which doesn't use &METHOD) you may get some idea of how the macro process is working, by reviewing the %PUT output in the log and looking at the titles for the proc print and the proc means output.
cynthia
[pre]
%macro loop_vals(lval=,delim=);
/*
lval is a string of variable values separated by *.
*/
%put inside macro *******;
%local i value;
%let i=1;
%let value=%scan(&lval,&i,&delim);
%if &value= %then %do;
%put ERROR- No values.;
%end;
%else %do;
%put @@@@@ i=&i value=&value do something for when i = 1;
proc print data=sashelp.class;
title "I=1 and value = &value";
run;
%end;
%do %until(&value= );
%let i=%eval(&i+1);
%let value=%scan(&lval,&i,&delim);
%if &value = kangaroo %then %do;
%put ***** inside do until: i=&i value=&value do something else for i ne 1;
%put ***** but ONLY do something if the value 'kangaroo' is in the LVAL list;
proc means data=sashelp.shoes min mean max;
var sales;
title "I= &i and value= &value";
run;
%end;
%if &value ne kangaroo %then %do;
%put --------> I= &i and value= &value NO PROC MEANS;
%end;
%end;
%mend;
ods listing;
options nosymbolgen nomprint nomlogic;
%loop_vals(lval=wombat#koala#kangaroo, delim='#');
%loop_vals(lval=kermit*gonzo*elmo, delim='*');
[/pre]