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

Question: Is there code to get a table of figures for the confidence intervals and prediction limits (dotted line in the diagram below) at each time period in the 'Results' tab?

 

Currently, here is my code so far:

 

/* MACRO to generate  poly curves based on x and y variables*/

/* dt_input : datset you wish to input tot he macro*/

/* modeller : variable to be modelled (i.e y axis)*/

/* var      : explanatoty varaible (i.e. x axis)*/

 

/* note poly test and ROC test uploaded from p drive - excel sheets*/

%macro poly_2(dt_input=roctest, modeller = cohortA, var = time );

 

  ods graphics on;

  proc orthoreg data = &dt_input

                     outest = poly_&modeller.

                     /*%if &Chart_Out. = 0 %THEN noprint;*/

                     ;

     effect xMod = polynomial (&var / degree = 2);

     model &modeller. = xMod / noint;

     effectplot fit / obs;

     store Ostore;

  run;

  ods graphics off;

 

  data poly_&modeller;

     length final_segment $20.;

     set poly_&modeller.;

     final_segment = "&modeller";

  run;

 

%mend;

%poly_2;

 

Extrapolation curve.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Since you are using the STORE statement to store the model, you can use PROC PLM and the SCORE statement to score the data. Here is an example that scores the model on the original data points:

 

proc plm restore=Ostore;
score data=&dt_input out=ScoreResults
      predicted LCLM UCLM LCL UCL;
run;

proc print data=ScoreResults(obs=10);
var &var &modeller
    predicted LCLM UCLM LCL UCL;
run;

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Since you are using the STORE statement to store the model, you can use PROC PLM and the SCORE statement to score the data. Here is an example that scores the model on the original data points:

 

proc plm restore=Ostore;
score data=&dt_input out=ScoreResults
      predicted LCLM UCLM LCL UCL;
run;

proc print data=ScoreResults(obs=10);
var &var &modeller
    predicted LCLM UCLM LCL UCL;
run;
jeremy4
Quartz | Level 8

Hi,

 

Thanks a lot for your reply, it is greatly appreciated!

 

From you advice, this is the code that I have adapted, with the Results output screenshot below. Can you please confirm that I have written the code correctly/that the Results table looks correct?

 

proc plm restore=Ostore;
score data=roctest out=ScoreResults
predicted LCLM UCLM LCL UCL;
run;

 

proc print data=ScoreResults(obs=10);
var time cohortA
predicted LCLM UCLM LCL UCL;
run;

 

PLM procedure extrapolation curves.PNG

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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