Date: Tue, 12 May 2009 13:28:36 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: Can't remove what appear to be blanks
In-Reply-To: A<200905122014.n4CGqfbm010811@malibu.cc.uga.edu>
Content-Type: text/plain; charset="iso-8859-1"
Hi Scott,
Having an editor that can display in hex
is handy to see what they really are. You
can use SAS to see the byte values as well.
See posting in the last couple days for a
working sample.
However, what you describe we can probably
surmize without it.
Obviously you are wanting to keep the Â
characters. These bytes have a hex value
of C2 which is 194 decimal. IF it is the
spaces you see inbetween these, if a reader
of these posts tries to copy and paste them
and apply a compress() function to it, you
will see that the spaces do indeed disappear.
From what you say, if you couldn't get rid
of them before is probably because they were
space characters with the highbit set. i.e.
a normal space character is a byte value of
32 decimal(20hex). The original value was
probably A0(160decimal). Many times email
and other applications and editors will filter
the highbit off of A0 spaces but let everything
else through.
The test for this would also work as the
solution for this.
Try (of course with the original data) changing
this
compress(trim(left(customer_name)),"- ' ")
to
compress(trim(left(customer_name)),"- ' "||byte(160))
Hope this is helpful.
Mark Terjeson
Investment Business Intelligence
Investment Management & Research
Russell Investments
253-439-2367
Russell
Global Leaders in Multi-Manager Investing
The byte() function above will add an A0 byte
to your list of characters to filter out.
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Scott Murff
Sent: Tuesday, May 12, 2009 1:15 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Can't remove what appear to be blanks
Hi,
Has anyone ever had the problem of not being able to remove what appear to
be blanks in a string?
I copy and pasted two cells from the view table.
This is the string before attempting to remove the blanks.
SCOTT SAMUELS Â Â Â Â Â Â Â Â Â Â Â THE THIRD
I then run this code:
proc sql;
create table customer as
select distinct customer_name,
compress(trim(left(customer_name)),"- ' ") as name
from b.hsbc_aml_data
order by customer_name;
quit;
This is the string in the new table.
SCOTTSAMUELSÂ Â Â Â Â Â Â Â Â Â Â THETHIRD
You will notice how the space between THE and THIRD is gone, but not the
other what appear to be spaces.
Any ideas? Thanks.