LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 18 Mar 2008 11:39:03 -0500
Reply-To:   Mary <mlhoward@avalon.net>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Mary <mlhoward@AVALON.NET>
Subject:   Re: How to create several dummy variables at the same time?
Comments:   To: "data _null_," <datanull@GMAIL.COM>, Wei Zeng <zengwei917@GMAIL.COM>
Content-Type:   text/plain; charset="iso-8859-1"

Yes, it looks like you would specify which is the reference category by the Zero= option. So cool!!

-Mary ----- Original Message ----- From: data _null_, To: SAS-L@LISTSERV.UGA.EDU Sent: Tuesday, March 18, 2008 11:30 AM Subject: Re: How to create several dummy variables at the same time?

I had to look up the option I think this is it, ZERO. See example program below.

ZERO=FIRST | LAST | NONE | SUM ZER=FIR | LAS | NON | SUM ZERO='formatted-value ' <'formatted-value ' ...> is used with CLASS variables. The default is ZERO=LAST.

The specification CLASS(variable / ZERO=FIRST) sets to missing the dummy variable for the first of the sorted categories, implying a zero coefficient for that category.

The specification CLASS(variable / ZERO=LAST) sets to missing the dummy variable for the last of the sorted categories, implying a zero coefficient for that category.

The specification CLASS(variable / ZERO='formatted-value') sets to missing the dummy variable for the category with a formatted value that matches 'formatted-value', implying a zero coefficient for that category. With ZERO=formatted-value-list, the first formatted value applies to the first variable in the specification, the second formatted value applies to the next variable that was not previously mentioned and so on. For example, CLASS(A A*B B B*C C / ZERO='x' 'y' 'z') specifies that the reference level for A is 'x', for B is 'y', and for C is 'z'. With ZERO='formatted-value', the procedure first looks for exact matches between the formatted values and the specified value. If none are found, leading blanks are stripped from both and the values are compared again. If zero or two or more matches are found, warnings are issued.

Example with Transreg. data A; input Y X1 $ X2 $; datalines; 8 a a 7 a a 4 a b 3 a b 5 b a 4 b a 2 b b 1 b b 8 c a 7 c a 5 c b 2 c b ;;;; run;

proc transreg; model class(X1 X2 / ZERO='a' 'a'); id y; output design; run; proc print; run; proc transreg; model class(X1 X2); id y; output design; run; proc print; run;

On Tue, Mar 18, 2008 at 10:30 AM, Mary <mlhoward@avalon.net> wrote: > Data null, > > Micky already replied to this- the user is using PROC MIANALYZE which clearly labels the CLASS statement as experimental and does not allow reference coding; the user stated that they could not get the CLASS statement to work in MIANALYZE as expected (I've never run that particular procedure). > > Can GLMMOD or TRANSREG create indicator variables with reference coding? If so, could you give an example? > > -Mary > ----- Original Message ----- > From: data _null_, > To: SAS-L@LISTSERV.UGA.EDU > Sent: Tuesday, March 18, 2008 8:52 AM > Subject: Re: How to create several dummy variables at the same time? > > > > On Tue, Mar 18, 2008 at 8:44 AM, <chris@oview.co.uk> wrote: > > Hi Mickey, > > > > I'm not sure if there's a better way to achieve what you're aiming > > for, > > Yes it is called the CLASS statement. But if you insist on creating > indicator variables PROC GLMMOD or PROC TRANSREG are better than any > data step method. >


Back to: Top of message | Previous page | Main SAS-L page