BookmarkSubscribeRSS Feed
LOLO12
Obsidian | Level 7

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;

 

3 REPLIES 3
tarheel13
Rhodochrosite | Level 12

what does the log say?

Tom
Super User Tom
Super User

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.

 

 

Sajid01
Meteorite | Level 14

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 404 views
  • 2 likes
  • 4 in conversation