Date: Wed, 7 Oct 2009 14:33:57 -0500
Reply-To: Robin R High <rhigh@UNMC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robin R High <rhigh@UNMC.EDU>
Subject: Re: a question in PROC GENMOD
In-Reply-To: <364629.16590.qm@web34304.mail.mud.yahoo.com>
Content-Type: text/plain; charset="US-ASCII"
An easy way would be to make a format and then apply it as in the GENMOD
code below. Or you can automate it my making a format with a DATA step
from the output of a sorted sas dataset, with the "illustrative" example
(only), where age (hazard) groups are sorted from low to high on a
randomly generated characteristic (premium), for which the highest average
value will serve as the reference age category:
data cls;
set sashelp.class;
xyz = 5+rannor(929);
proc means data=cls noprint nway;
class age;
var xyz;
output out=new(drop= _: ) mean=m_xyz;
run;
proc sort; by m_xyz;
proc print; run;
* make a numeric format sorted by mean value of xyz and attach the actual
age to it ;
DATA ctrl; length label $8 ;
SET new end=eof;
KEEP start label fmtname type hlo;
RETAIN fmtname 'ag' type 'n';
start=age;
label = CATT(put(_n_, z2.),'_',put(age,2.)); output;
RUN;
PROC PRINT data=ctrl NOobs; RUN;
proc format cntlin=ctrl; run;
proc genmod data=sashelp.class order=formatted ;
class age;
model height = age ;
lsmeans age;
format age ag. ;
run;
From:
wei yi <wy78712@YAHOO.COM>
To:
SAS-L@LISTSERV.UGA.EDU
Date:
10/07/2009 11:01 AM
Subject:
a question in PROC GENMOD
Sent by:
"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
When I conducted "proc genmod ......" in SAS, is there a way that I can
set the level with the highest amount $ as a base level? I know how to set
the level with the most frequcy as base level. I just want to know whether
I could write the command to set the highest amount as the base level. for
exam, I have a class varialble called hazard group 1 to 4, then I wanted
to set the hazard group with highest premium as the base level, is there
an easy way to do it?
thanks,
Vivian