Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
CaraJ
Calcite | Level 5


Hello, I am running a quantile regression and do not want to use the standard options associated with the ORDER=statement in QUANTREG. I would instead like to establish my own reference/comparison group-is there a way currently to do this with the QUANTREG method?

Thank you

proc quantreg data=dataset ci=resampling (nrep=500); by Pathogen; class commodity;

model ill=commodity/quantile=0.25 0.5 0.75 plot=quantplot;

run;

5 REPLIES 5
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Unlike with some other PROCs (e.g., LOGISTIC), QUANTREG does not have an option to change the reference level in the CLASS statement. You will have to use the ORDER= option.

CaraJ
Calcite | Level 5

Hi Ivm, I was afraid of that. Is there a way I could use a format feature possibly to use the default of ORDER=Formatted? Thank you

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

My approach would be to create a new variable in a data step, to be used as the CLASS variable. If you are using a character variable, the reference level should start with a "z" or "zz" so that it is the last one.

CaraJ
Calcite | Level 5

Thank you so much-I like that idea.

1zmm
Quartz | Level 8

Create a new format value for the CLASS variable you want to specify a reference level for.  For example, if "Barley" is the commodity you want as your reference level for all your commodities, use a PROC FORMAT VALUE statement to create a formatted value that sorts at the end of all formatted values by preceding that value with one or more right braces ("}"): 

   proc format;

       value $comm "Barley"="}} Barley";

   run;

   proc quantreg . . . order=formatted;

       class commodity;

       . . . .

       format commodity $comm.;

   run;

       

This syntax will make "Barley" the reference level for the classification variable, commodity.

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


Register now!

What is ANOVA?

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.

Discussion stats
  • 5 replies
  • 3376 views
  • 0 likes
  • 3 in conversation