BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
xinjian
Calcite | Level 5

Dear All,

I made a fit plot graph  with attached file using SAS 9.4, the program is below:

ods listing sge = on;

procreg data=baseline2;

model ba=bs;

run;

I don't want legends especially 'observation, parameters, error DF, etc'.

I appreciate your help.

Thanks,

Xinjian

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

There is no way to remove a Legend or the Statistics table from a graph using the ODS Graphics Editor.  However, you could use the following code to get the data from proc REG and plot it using SGPLOT.

ods output fitplot=fitdata;

proc reg data=sashelp.class;

model weight=height;

run;

proc sort data=fitdata out=sorted;

by _indepvar1;

run;

ods graphics / reset width=6in height=4in imagename='ClassWeightbyHeightFitPlot';

proc sgplot data=sorted nocycleattrs noautolegend;

  band x=_indepvar1 upper=uppercl lower=lowercl / nofill lineattrs=(pattern=dash);

  band x=_indepvar1 upper=upperclmean lower=lowerclmean;

  reg x=_indepvar1 y=predictedvalue / nomarkers;

  scatter x=_indepvar1 y=depvar;

run;

For a simple fit plot, it would be even easier to just use the REG statement inside proc SGPLOT:

ods graphics / reset width=6in height=4in imagename='ClassFitPlot';

proc sgplot data=sashelp.class nocycleattrs noautolegend;

  reg x=height y=weight / cli clm;

run;

View solution in original post

2 REPLIES 2
Jay54
Meteorite | Level 14

There is no way to remove a Legend or the Statistics table from a graph using the ODS Graphics Editor.  However, you could use the following code to get the data from proc REG and plot it using SGPLOT.

ods output fitplot=fitdata;

proc reg data=sashelp.class;

model weight=height;

run;

proc sort data=fitdata out=sorted;

by _indepvar1;

run;

ods graphics / reset width=6in height=4in imagename='ClassWeightbyHeightFitPlot';

proc sgplot data=sorted nocycleattrs noautolegend;

  band x=_indepvar1 upper=uppercl lower=lowercl / nofill lineattrs=(pattern=dash);

  band x=_indepvar1 upper=upperclmean lower=lowerclmean;

  reg x=_indepvar1 y=predictedvalue / nomarkers;

  scatter x=_indepvar1 y=depvar;

run;

For a simple fit plot, it would be even easier to just use the REG statement inside proc SGPLOT:

ods graphics / reset width=6in height=4in imagename='ClassFitPlot';

proc sgplot data=sashelp.class nocycleattrs noautolegend;

  reg x=height y=weight / cli clm;

run;

xinjian
Calcite | Level 5

It is good to know ods graphic editor cannot change legend. I tried your way to get job done. Thanks so much for your effort.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 2 replies
  • 1350 views
  • 0 likes
  • 2 in conversation