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 (January 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 12 Jan 2007 10:03:31 -0500
Reply-To:     Ya Huang <ya.huang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ya Huang <ya.huang@AMYLIN.COM>
Subject:      Re: Remove a format via proc sql, a workaround
Comments: To: Venky Chakravarthy <swovcc@HOTMAIL.COM>

This one seems to work:

proc format; value $gen 'M'='Male' 'F'='Female' ;

data class; set sashelp.class; format age date. sex $gen.; run;

proc contents; run;

proc sql; create table xx (drop=age sex rename=(newage=age newsex=sex)) as select *, (age+0) as newage, trim(sex) as newsex from class ;

proc contents; run;

On Fri, 12 Jan 2007 09:23:05 -0500, Venky Chakravarthy <swovcc@HOTMAIL.COM> wrote:

>On Thu, 11 Jan 2007 19:03:55 -0500, Kevin Roland Viel <kviel@EMORY.EDU> >wrote: > >>On Thu, 11 Jan 2007, Venky Chakravarthy wrote: >> >>> >To the best of my knowledge you cannot do this directly. I see that data >>> >_null_ has shown a trick but in essence a format is being assigned and >not >>> >removed as you want it. Alas $F is an alias for the $W format which >>> >defaults to $8. The SASHELP.CLASS has all names less than or equal to 8 >>> >characters so this works fine. Likewise, the equivalent numeric format >>> >alias is F for the W.d format. Unfortunately that seems to default to 1 >for >>> >a format length. >> >>Then create a view: >> >>data junk_view / view = junk_view ; >> set v.junk ; >> format PersonID ; >>run ; >> >>proc sql ; >> select distinct PersonID , PersonID >> from junk_view >> ; >>quit ; >> >>Note, I threw a distinct in for good measure. Sorry, can't say I use >>unique, yet :) >> >>HTH, >> >>Kevin >> >> >>Kevin Viel >>PhD Candidate >>Department of Epidemiology >>Rollins School of Public Health >>Emory University >>Atlanta, GA 30322 > >Hey Kevin, > >The VIEW is cool. However, it would still have to be a DATA STEP created >VIEW to solve the problem. The DISTINCT :-) issue here is can we use SQL to >remove the assigned formats? > >Regards, > >Venky


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