Programming the statistical procedures from SAS

Establishing reference group/level in Proc Quantreg

Reply
Occasional Contributor
Posts: 16

Establishing reference group/level in Proc Quantreg


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;

Valued Guide
Valued Guide
Posts: 684

Re: Establishing reference group/level in Proc Quantreg

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.

Occasional Contributor
Posts: 16

Re: Establishing reference group/level in Proc Quantreg

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

Valued Guide
Valued Guide
Posts: 684

Re: Establishing reference group/level in Proc Quantreg

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.

Occasional Contributor
Posts: 16

Re: Establishing reference group/level in Proc Quantreg

Thank you so much-I like that idea.

Regular Contributor
Posts: 152

Re: Establishing reference group/level in Proc Quantreg

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.

Ask a Question
Discussion stats
  • 5 replies
  • 431 views
  • 0 likes
  • 3 in conversation