Date: Tue, 5 Dec 2006 18:00:23 -0500
Reply-To: Nicholas Mitsakakis <n.mitsakakis@UTORONTO.CA>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nicholas Mitsakakis <n.mitsakakis@UTORONTO.CA>
Subject: Re: nominal to dummy
In-Reply-To: <Pine.GSO.4.58.0612051238300.20416@leukothea>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi Kevin,
I need to use PROC PHREG, which unfortunately does not have a class
statement.
Nicholas
Kevin Roland Viel wrote:
>On Tue, 5 Dec 2006, Nicholas Mitsakakis wrote:
>
>
>
>>Hello,
>>
>>I have a SAS data set with many nominal variables, with integer values. For
>>each one of these variables there is a corresponding format, which assigns
>>some text to each of the variable values, For example, the variable
>>"weather" takes values 1-5 and there is a format wthfmt where 1 corresponds
>>to "very good", 2 to "good", 3 to "medium", 4 to "bad" and 5 to "very bad".
>>
>>Now I want to generate 4 dummy variables for this data set, and for our
>>example, their names or labels and values should be as follows:
>>- "very bad vs very good" should take the value 1 if weather=5, otherwise 0
>>- "bad vs very good" should take the value 1 if the weather=4, otherwise 0
>>- "medium vs very good" should take the value 1 if the weather=3, otherwise 0
>>- "good vs very good" should take the value 1 if the weather=2, otherwise 0
>>
>>Now, since I have many nominal variables of this type (not just weather),
>>and each one of those with different number of levels, I want to find some
>>way to do this automatically.
>>
>>If anyone has any ideas of how this can be done, please let me know, I would
>>appreciate it.
>>
>>
>
>Could you tell us why you want to create dummy variables? Most of your
>statistical procedures have a CLASS statement. Combined with a format or
>a CONTRAST/ESTIMATE/LSMEAN statement, you may be able to accomplish what
>you'd like.
>
>HTH,
>
>Kevin
>
>
>Kevin Viel
>PhD Candidate
>Department of Epidemiology
>Rollins School of Public Health
>Emory University
>Atlanta, GA 30322
>
>
--
Nicholas Mitsakakis
PhD Candidate - Biostatistics
Department of Public Health Sciences
University of Toronto
|