Hi All,
this macro dosn't work not sure what is the issue.
%macro create_graph(_paramn=, _param=, _avision=, _trta=, _usubjid=);
data _null_;
set all;
where paramn=&_paramn. & param="&_param." & avision="&_avision." & trta="&_trta." & usubjid="&_usubjid.";
call symput('Int', put(intercept, BEST6.));
call symput('Slope', put(slope, BEST6.));
run;
proc sgplot data=all noautolegend;
where trta="&_trta." & usubjid="&_usubjid.";
title "Regression Line with Slope and Intercept";
reg y=aval x=accommodation_level;
inset "Intercept = &Int" "Slope = &Slope" /
border title="Parameter Estimates" position=topleft;
run;
%mend;
data test;
set all;
by paramn param avision trta usubjid NOTSORTED;
if first.usubjid then
do;
str=catt('%create_graph(_paramn=', paramn, ", _param=", param,
" , _avision=", avision, ", _trta= ", trta, ", _usubjid=", %str(usubjid),
');');
output;
end;
run;
what does the log say?
You never call the macro in the code you posted.
You define a macro.
You create a dataset with a character variable that looks like perhaps it has the code to call the macro. But you never run the code you put into the character variable.
Hello @LOLO12
Did you try the code before creating the macro?
Have a look at this blog post How to use PROC SGPLOT to display the slope and intercept of a regression line - The DO Loop (sas.co...
This will help you understand using Proc SGPLOT do what you want.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.