%let k=6;
%let l=5;
%let m=1;
%test(nb=5);
%macro cccc;
%do %until(min>=0.7);
if pe<0.7 & ps>=0.7 then
do; %let l=%eval(&l-1); %let m=&m; end;
if ps<0.7 & pe>=0.7 then
do; %let m=%eval(&m+1);%let l=&l; end;
if pe<0.7 & pe<0.7 then do;
%let l=%eval(&l-1);
%let m=%eval(&m+1); end;
%test(nb=5);
%end;
med[1,1]=%eval(&l+1);
msd[1,1]=%eval(&m-1);
print med msd; print &l &m;
%mend;
%cccc;
Hello,
I have the problem of ignoring conditional execution and executing all three cases.
what should i do?
Hello,
Should you use macro statements i.e. with % sign:
%if %then %do %end
...?
You obviously have no clue what the macro facility is meant for.
See this:
%do %until(min>=0.7);
if pe<0.7 & ps>=0.7 then
do; %let l=%eval(&l-1); %let m=&m; end;
Using macro statements this way can NEVER work. The %let statements are dealt with when the code for the data or proc step is fetched and compiled, so trying to execute them conditionally is nonsense.
And a condition like that:
%do %until(min>=0.7);
can also never work, as the macro facility will compare the text "min" with the text "0.7", so min>=0.7 is always true.
What are you trying to do?
Post your whole code, as what you have posted is missing lots of important items (like the procedure around the macro):
@shkim wrote:
%let k=6;
%let l=5;
%let m=1;%test(nb=5);
%macro cccc;
%do %until(min>=0.7);
if pe<0.7 & ps>=0.7 then
do; %let l=%eval(&l-1); %let m=&m; end;
if ps<0.7 & pe>=0.7 then
do; %let m=%eval(&m+1);%let l=&l; end;
if pe<0.7 & pe<0.7 then do;
%let l=%eval(&l-1);
%let m=%eval(&m+1); end;
%test(nb=5);
%end;
med[1,1]=%eval(&l+1);
msd[1,1]=%eval(&m-1);
print med msd; print &l &m;%mend;
%cccc;
Hello,
I have the problem of ignoring conditional execution and executing all three cases.
what should i do?
ex data)
proc iml;
ze_0={1,2,3};
zs_0{1,3,5};
ze_1={2,3,4};
zs_1={2,4,2};
ze_2={1,3,2};
zs_2={2,5,4};
quit;
pe=#{max(ze_i[&l,1],zs_i[&m,1])>=ze_0[&l,1]}/nb
ps=#{max(zs_i[&l,1],zs_i[&m,1])>=zs_0[&m,1]}/nb
i=1,2
nb=2
I have already complete macro program code that computes pe and ps. (%test)
but, i don't know how to code this part.
Initial value l=3 , m=1
if pe < 0.05 then I = l-1, If ps < 0.05 then m = m + 1,
and pe and ps must be repeated until both are greater than 0.05.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.