Date: Thu, 18 Jul 1996 17:06:24 GMT
Reply-To: Frank Schnekenburger <ay987@FreeNet.Carleton.CA>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Frank Schnekenburger <ay987@FREENET.CARLETON.CA>
Organization: The National Capital FreeNet
Subject: Re: help!!!
Wei Jin (firstname.lastname@example.org) writes:
> 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
Hello, Assuming that A is sequential and inclusive (1, 2, 3 ... n),
the following code should do the trick (no if statements required).
* create sample file of variable A;
input a @@;
4 2 3 1 3 5 1 4 2 4 3
* create a lookup table for conversion, specifying values of B in the
order corresponding to the 1, 2, 3... of A;
input b @@;
9 13 27 37 49
* convert A to B;
set lookup point=a;