Hello,
I am using the BY statement in PROC QUANTREG along with ODS OUTPUT in order to generate a dataset with all of the listed quantile estimates for all of the models. The below code does this for just one of the models, instead of all ten which is desired. Further below is the code for a reproducible example. Any suggestions would be appreciated.
proc quantreg ci=sparsity/iid algorithm=interior(tolerance=1.e-4)
data=table alpha=0.01;
model diff_6 = /
quantile= 0.05 to 0.95 by 0.15
plot=quantplot;
ods output ParameterEstimates = Estimates;
run;
Reproducible full code, there are some elements still included in the data creation step that aren't relevant to the inquiry, but these variables should be apparent.
%let N = 20;
%let Numsamples = 10;
data Table1 (keep=Baseline Xc_3 sampleID);
call streaminit(4321);
p0 = 1.00;
p1 = 0.60; p2 = 0.20; p3 = 0.10; p4 = 0.05; p5 = 0.03; p6 = 01; p7 = 0.01; p8 = 0.0;
do sampleID = 1 to &numsamples;
do i = 1 to &N;
Baseline = rand("Table1", p0);
Xc_3 = rand("Table1", p1, p2, p3, p4, p5, p6, p7, p8);
output;
end;
end;
run;
data Table2 (keep=Xc_6);
call streaminit(432109);
p1 = 0.60; p2 = 0.20; p3 = 0.10; p4 = 0.05; p5 = 0.03; p6 = 01; p7 = 0.01; p8 = 0.0;
do sampleID = 1 to &numsamples;
do i = 1 to &N;
Xc_6 = rand("Table1", p1, p2, p3, p4, p5, p6, p7, p8);
output;
end;
end;
run;
data Table3 (keep=Xnc_3);
call streaminit(43927);
p1 = 0.80; p2 = 0.13; p3 = 0.05; p4=0.02;
do sampleID = 1 to &numsamples;
do i = 1 to &N;
Xnc_3 = rand("Table3", p1, p2, p3, p4);
output;
end;
end;
run;
data Table4 (keep=Xnc_6);
call streaminit(43215);
p1 = 0.80; p2 = 0.13; p3 = 0.05; p4=0.02;
do sampleID = 1 to &numsamples;
do i = 1 to &N;
Xnc_6 = rand("Table3", p1, p2, p3, p4);
output;
end;
end;
run;
data Table;
merge Table1-Table4;
run;
data Table;
set Table;
Baseline = Baseline + 19;
Xc_3 = Xc_3-1;
Xc_6 = Xc_6-1;
Xc_6t = Xc_3 + Xc_6;
Xnc_3 = Xnc_3-1;
Xnc_6 = Xnc_6-1;
Xnc_6t = Xnc_3 + Xnc_6;
diff_3 = Xc_3 - Xnc_3;
diff_6 = Xc_6t - Xnc_6t;
run;
proc freq data=table;
tables (Baseline
Xc_3
Xc_6
Xc_6t
Xnc_3
Xnc_6
Xnc_6t
diff_3
diff_6) * sampleID / nocum;
run;
ods graphics on;
proc quantreg ci=sparsity/iid algorithm=interior(tolerance=1.e-4)
data=table alpha=0.01;
by sampleID;
model diff_3 = /
quantile= 0.05 to 0.95 by 0.15
plot=quantplot;
run;
ods graphics off;
ods trace on;
ods graphics on;
proc quantreg ci=sparsity/iid algorithm=interior(tolerance=1.e-4)
data=table alpha=0.01;
model diff_6 = /
quantile= 0.05 to 0.95 by 0.15
plot=quantplot;
ods output ParameterEstimates = Estimates;
run;
ods graphics off;
ods trace off;
@H wrote:
Hello,
I am using the BY statement in PROC QUANTREG along with ODS OUTPUT in order to generate a dataset with all of the listed quantile estimates for all of the models. The below code does this for just one of the models, instead of all ten which is desired. Further below is the code for a reproducible example. Any suggestions would be appreciated.
What is your question?
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.