Date: Wed, 6 Aug 2003 13:48:41 +0500
Reply-To: Arslan Zaheer Dar <arslanzaheerdar@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arslan Zaheer Dar <arslanzaheerdar@HOTMAIL.COM>
Subject: Re: How to change the value of a character variable.
Content-Type: text/plain; charset="iso-8859-1"
Alex - There are 2 ways to get the desired results,
Data a;
input slno name$10. ;
cards;
1 motor
2 auto
3 motor
4 auto
5 motor
6 auto
run;
Method 1
------------
data b;
set a;
if name='motor' then name='motor cycle';
run;
Method 2
----------
proc sql;
update a
set name='motor cycle'
where name='motor';
In both cases, you have to set the length of variable name big enough to
accomodate the new value 'motor cycle' because it exceeds the default length
of 8 bytes for character variables.
Hope this helps,
Regards,
Arslan Zaheer Dar
Senior Consultant
PwC Consulting Pakistan
----- Original Message -----
From: "alex nilla" <alexnilla@YAHOO.COM>
Newsgroups: bit.listserv.sas-l
To: <SAS-L@LISTSERV.UGA.EDU>
Sent: Wednesday, August 06, 2003 1:14 PM
Subject: How to change the value of a character variable.
> Hello all,
>
> I have a data set with one character variable.
>
> Data a;
> input slno name$10;
> cards;
> 1 motor
> 2 auto
> 3 motor
> 4 auto
> 5 motor
> 6 auto
> run;
>
> I would like to change the values of the character
> variable 'name' from motor to motor cycle.
>
>
> Data b;
> 1 motor cycle
> 2 auto
> 3 moto cycle
> 4 auto
> ;
>
> regards,Thanks.
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>