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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.