Date: Mon, 12 Mar 2007 16:08:14 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Replace character
In-Reply-To: <7367b4e20703120900o7fad1264ue25b9b4fed45462a@mail.gmail.com>
Content-Type: text/plain; format=flowed
Data _Null_ ,
I dont Tranwrd seems to do a pretty darn good job of solving the problem:
Data _Null_ ;
Text1 = '123.321' ;
Text2 = TranWrd( Text1 , '.' , ',' ) ;
Put _all_ ;
Run ;
Toby Dunn
To sensible men, every day is a day of reckoning. ~John W. Gardner
The important thing is this: To be able at any moment to sacrifice that
which we are for what we could become. ~Charles DuBois
Don't get your knickers in a knot. Nothing is solved and it just makes you
walk funny. ~Kathryn Carpenter
From: "data _null_;" <datanull@GMAIL.COM>
Reply-To: "data _null_;" <datanull@GMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Replace character
Date: Mon, 12 Mar 2007 12:00:24 -0400
Don't use TRANWRD to replace single characters use TRANSLATE.
But as Toby suggests it may be a formatting issue and you just need
the right format or informat. We need more information.
1302 data _null_;
1303 text1='123.321';
1304 text2=translate(text1,',','.');
1305 put (text:) (=);
1306
1307 n1 = input(text1,f10.);
1308 put n1=commax10.3;
1309
1310 n2= input(text2,commax10.);
1311 put n2=comma10.3;
1312
1313 run;
text1=123.321 text2=123,321
n1=123,321
n2=123.321
On 3/12/07, Miguel de la Hoz <miguel_hoz@yahoo.es> wrote:
>Hi all,
>
> I have a simple doubt, I need to replace the character from a text. I
>need to go from text1=123.321 to text1=123,321
>
> Do you know any replace function in SAS that I can use to achieve this.
>
> Thanks in advance,
>
> MAH.
>
>
>---------------------------------
>
>LLama Gratis a cualquier PC del Mundo.
>Llamadas a fijos y móviles desde 1 céntimo por minuto.
>http://es.voice.yahoo.com
>
_________________________________________________________________
Play Flexicon: the crossword game that feeds your brain. PLAY now for FREE.
http://zone.msn.com/en/flexicon/default.htm?icid=flexicon_hmtagline