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 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 28 Jan 2003 15:16:02 -0500
Reply-To:     Kevin Viel <kviel@EMORY.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Kevin Viel <kviel@EMORY.EDU>
Subject:      Re: Dynamic format name
Content-Type: text/plain; charset="iso-8859-1"


Try the PUTC function:

proc format; value $ fa "100"="cien"; value $ fb "100"="sto"; run;

data a; F='fa'; B='100'; output; F='fb'; B='100'; output; run;

data b; length c $ 4; set a; C=putc(B, f); run;

proc print data=b; run;


Kevin ____________________________________

Kevin Viel Department of Epidemiology Rollins School of Public Health Emory University Atlanta, GA 30329

----- Original Message ----- From: "Yadong Zhang" <yzhang@OXHP.COM> Newsgroups: To: <SAS-L@LISTSERV.UGA.EDU> Sent: Tuesday, January 28, 2003 2:35 PM Subject: Dynamic format name

> Hello, > I have a table lookup problem I'm trying to solve with 'Dynamic Format > Name', ie, the format name is derived from another variable. > > For example, > I have two predefined formats: $fa and $fb, > I want to create a new variable C based on the format stored in > variable F > data a; > F='fa'; B='100'; output; > F='fb'; B='100'; output; > run; > > data b; > set a; > C=put(B, '$' || F ||'.'); > run; > > Is this doable? Is there any easy alternative? > > Thanks in advance. > > Yadong >

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