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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2803 views
  • 0 likes
  • 3 in conversation