LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (August 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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.
Comments: To: alex nilla <alexnilla@YAHOO.COM>
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 >


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