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;
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;
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;
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;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.