Date: Wed, 24 Jun 2009 13:35:32 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Windows carriage return
In-Reply-To: <9621fcfd-65e0-4159-b306-b895fba08608@y38g2000vbl.googlegroups.com>
Content-Type: text/plain; charset=windows-1252
As _null_ refers to later, you can use COMPRESS also. I think specifically
'c' option (control characters):
field=compress(field,,c);
-Joe
On Wed, Jun 24, 2009 at 12:28 PM, dornakul <postitdummy@arcor.de> wrote:
> Hi,
>
> Thanks for the help. I should have searched the newsgroup first:
>
> http://groups.google.de/group/comp.soft-sys.sas/browse_thread/thread/201f2684a4b6784b/b9c0869c07aa824d?hl=de&lnk=gst&q=carriage+return+#b9c0869c07aa824d
>
> field=translate(field,'','0D0A'x);
>
> worked for me.
>
> Bye
> Dornak
>
> On 24 Jun., 19:22, Suzanne Humphreys <suzanne.humphr...@gmail.com>
> wrote:
> > On Jun 24, 10:18 am, Dornak <postitdu...@arcor.de> wrote:
> >
> > > Hi,
> > > I have a Windows carriage return in one of my fields in a dataset.
> > > I am using UNIX SAS 8.2
> > > How can I get rid of this character? trim(left(field)) doesn't work.
> > > Thanks
> > > Dornak
> >
> > Hi Dornak
> >
> > Try this, a colleague suggested it to me.
> >
> > thanks
> > Suzanne
> >
> > data
> > test;
> > test="
> > asdfjk™";
> > run;
> >
> > PROC PRINT DATA=TEST; TITLE
> > 'BEFORE';RUN;
> >
> > data
> > test;
> > set
> > test;
> >
> > %macro
> > repair;
> > %do i=1 %to
> > 255;
> > if
> indexc(byte(&i),':;=1234567890-~!@#$%^&*()_+}{[]\|/><.,ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
> ')=0 then
> >
> > do;
> > test=compress(test,byte
> > (&i));
> >
> > end;
> >
> > %end;
> > %mend
> > repair;
> >
> > %repair;
> > run;
>
|