Hi Experts, Hope you could enlighten me with this. I have a quite challenging problem using macros. Is it possible to call a procedure inside the sql? I think it will be better to show it in an example. PROGRAM A: %macro a; %let test_value = test_val; &test_value %mend a; data sample; msg = "this is a test"; run; proc sql; create table a as select msg, RESOLVE('%a') as val from sample ; quit; proc print data = a; run; The output of these codes is the ff: MSG VAL this is a test test_val So as I understand, RESOLVE uses the value in %a. But what if aside from value resolution, an exception handling procedure is also embedded? Is this possible? I tried doing this code: PROGRAM B: %macro a;proc_, %let test_value = test_val; &test_value %if &test_value = test_val %then %do; data excep_dat; val= “There is data exception.”; run; %end; %mend a; Supposed to be, the expected output is that it will also produce a dataset named excep_dat. But what the output is shows is: Obs msg val 1 this is a test test_val data excep_dat; val= “There is data exception.”; run; Is there a way to allow the production of the dataset? Or if this procedure is not valid, hope you could confirm so that we can think of another step to handle it. Thanks!
... View more