在SAS 中可以试试
proc glm data = data ordr = data (或 freq);
class ratio;
model y = x1 x2 ratio /solution;
run;
这里proc glm will generate dummy variables for a categorical variable, 所以不需要自己code manually (就像楼上朋友的回答)。
其中 order= 是选定哪个level为base line。如果你用 ordr = data,那么需要先对你的data进行排序,比如
proc sort data= data; by ratio descending (或ascending);run;
若使用 order = freq,则order the levels of class variable according to descending frequency count so that levels with the most observations come first in the order。
order = 可能还有别的选项,但我只用过=data 或 freq这两个,你可以google一下。
Does it work?
温馨提示:答案为网友推荐,仅供参考