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 (July 1996, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 17 Jul 1996 14:43:57 GMT
Reply-To:     Laura Aaronson <aaronsonlm@ZEN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Laura Aaronson <aaronsonlm@ZEN.COM>
Organization: Zeneca Inc.
Subject:      Re: help!!!

Wei Jin <jin.fpg@mhs.unc.edu> wrote: >I met a problem about converting one variable to the other. Say, >I have variable A which has possible value "1,2,3...." and I would >like to creat variable B which has possible value "9,13,27,...". there >seems no mathematic connection between the two group of value except >if A=1 then B=9, if A=2 then B=13 etc. I have 100 value in each group. >Is there any "elegant" way to do the convertion other than 100 if-then >clause? >

How about using a format? Much more elegant -- and more efficient -- than all those IF..THEN statements:

DATA B; SET A; B = INPUT(PUT(A,BFMT.),BEST.); RUN;

To make format "BFMT" you could write a big PROC FORMAT, or, make a dataset of 100 records, each containing the value of A and its corresponding value of B, and use it as a CNTLIN dataset (see documentation for PROC FORMAT).

Laura

My opinions are my own and do not necessarily represent those of Zeneca Pharmaceuticals.


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