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 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Mar 2009 11:59:50 -0400
Reply-To:     Jim Groeneveld <jim.1stat@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jim Groeneveld <jim.1stat@YAHOO.COM>
Subject:      Re: VALUE LABELS
Comments: To: "./ ADD NAME=data _null_;" <iebupdte@GMAIL.COM>

Hi iebupdte and erwan,

I think reversing a format is not so much applicable if it would result in ambiguously formatted values. E.g. if you have

PROC FORMAT; VALUE _TestFmt 0 - 2 = lowest 2 <- 4 = low 4 <- 6 = average 6 <- 8 = high 8 <- 10 = highest ; RUN;

What should be the reversed format?

In SAS it is technically possible to have ambiguous formats, values that point to more than one formatted value. Those formats are called MULTILABEL formats and I apply them in my presentation on SGF 2009.

However, without reversing a format a current format (format catalog) can be seen with/via PROC CATALOG and with PROC FORMAT with the FMTLIB or CNTLOUT options. See your documentation on the syntax.

Regards - Jim. -- Jim Groeneveld, Netherlands Statistician, SAS consultant home.hccnet.nl/jim.groeneveld

My computer, my wife and I will attend SGF 2009 near Washington.

On Thu, 19 Mar 2009 10:36:58 -0500, ./ ADD NAME=Data _null_; <iebupdte@GMAIL.COM> wrote:

>I was thinking of a reverse INFORMAT created similar to Jack's reverse >FORMAT. I'm not sure if there is a reason to prefer one method over >the other. > >proc format cntlout=control; > select cntfmt; > value cntfmt > 1="FR" > 2="GE" > 3="IT" > 4="SP" > 5="UK" > 6="US"; > run; >*proc print; > run; >data informat; > set control; > type = 'I'; > hlo = 'UJ'; > rename start=label label=start; > drop end; > run; >proc format cntlin=informat fmtlib; > run; >data _null_; > do c = 'FR','GE'; > country = input(c,cntfmt.); > put (_all_)(=); > end; > run; > > >On 3/19/09, Jack Clark <jclark@hilltop.umbc.edu> wrote: >> Erwan, >> >> You could use the format to create a "reverse" format. It I think this >> would work OK as long as there were not multiple numbers assigned to a >> country abbreviation. >> >> >> proc format library=work; >> value cntfmt >> 1="FR" >> 2="GE" >> 3="IT" >> 4="SP" >> 5="UK" >> 6="US"; >> run; >> >> * select cntfmt. from format library ; >> * and output to sas data set; >> proc format library=work cntlout=country; >> select cntfmt; >> run; >> >> * eliminate any duplicate values of country ; >> * (if there are duplicates, this is probably not a good solution!) >> proc sort nodupkey data = country; >> by label; >> run; >> >> >> * create new format ; >> data country; >> set country (keep=start label rename=(start=label label=start)); >> retain fmtname 'cntfmt' type 'c'; >> run; >> >> proc format library=work cntlin=country fmtlib; >> run; >> >> >> >> >> >> Jack >> >> >> >> Jack Clark >> Senior Research Analyst >> phone: 410-455-6256 >> fax: 410-455-6850 >> jclark@hilltop.umbc.edu >> >> University of Maryland, Baltimore County >> Sondheim Hall, 3rd Floor >> 1000 Hilltop Circle >> Baltimore, MD 21250 >> >> >> >> >> Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee(s) named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying of this e-mail, distribution, or action taken in reliance on the contents of this e-mail and/or documents attributed to this e-mail is strictly prohibited. If you have received this information in error, please notify the sender immediately by phone and delete this entire e-mail. Thank you.-----Original Message----- >> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >> Erwan LE DU >> Sent: Thursday, March 19, 2009 10:50 AM >> To: SAS-L@LISTSERV.UGA.EDU >> Subject: VALUE LABELS >> >> Hi all, >> >> I have a variable numeric variable COUNTRY for which I assigned the >> value labels: >> >> proc format library=SAS.formats; >> value cntfmt >> 1="FR" >> 2="GE" >> 3="IT" >> 4="SP" >> 5="UK" >> 6="US"; >> run; >> >> Is there a SAS function returning the variable value from the value >> label? >> As : >> F(country, "FR") --> 1 >> F(country,"GE")--> >> >> Thanks for your help, >> >> Erwan >>


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