BookmarkSubscribeRSS Feed
LizC
Calcite | Level 5

I am using proc transreg (splines and knots) to generate a spline regression fit. I have tried many methods to modify the plot with no results.

My plot is similar to this plot from the SAS user guide:

enter image description here

The SAS code used to generate the plot above is

title2 'A Cubic Spline Fit with Knots at X=5, 10, 15';

proc transreg data=a; model identity(y) = spline(x / knots=5 10 15); run;

How do I modify the plot so that

1) only the fit line and its 95% CI are left on the graph? I wanted to get rid off the observed data points and the 95% CI for the observed.

2) How do I change the y axis scale to [0, 30]

Your help is greatly appreciated!

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

If you turn on ods trace, in front of your code:

ods trace on;

Then run the code it will show you the components which are created by the procedure.  You should then be able to recreate these in GTP/SGplot, and then change them as much as you like.  For example:

https://books.google.be/books?id=7k8EL-CcoroC&pg=PA15&lpg=PA15&dq=sas+proc+transreg+output+gtl&sourc...

LizC
Calcite | Level 5

Thank you I will try this!

Jay54
Meteorite | Level 14

It is easier to help if you provide the full program with data.

Here is what you can do.  Enable ods trace using 'ODS TRACE ON;'  In the log, find the name of the graph and the template used for this graph.  Now, you can modify the template itself (carefully) and remove the CLM option and the SCATTERPLOT statement.  Add the options to set the axis range you want.  Compile and save the template to your SASUSER.TEMPLAT itemstore.  Now, rerun the TRANSREG procedure and you should get the graph you desire.

Alternatively, save the data created by the procedure for this graph using ODS OUTPUT obj-name=dataset name.  Then, use SGPLOT to create the graph.

LizC
Calcite | Level 5

Thank you very much i will try this.

sas-innovate-2024.png

 

Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.

 

Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 

 

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
  • 4 replies
  • 929 views
  • 0 likes
  • 3 in conversation