|
Use $hex. format to see what the non-printable character is
then use compress() to get rid of it:
data junk;
a='ABCD'||'A0'x;
run;
proc print;
format a $hex.;
run;
data junk1;
set junk;
a=compress(a,'A0'x);
run;
proc print data=junk1;
run;
On Fri, 31 Oct 2008 13:14:34 -0700, Tiffany <tiffany.vidal@GMAIL.COM> wrote:
>On Oct 31, 3:55 pm, jcl...@HILLTOP.UMBC.EDU (Jack Clark) wrote:
>> Issue a length statement to set the variable to $6
>>
>> Data new;
>> Length hullnum $ 6;
>> Set old;
>> Run;
>>
>> Jack Clark
>> Senior Research Analyst
>> phone: 410-455-6256
>> fax: 410-455-6850
>> jcl...@hilltop.umbc.edu
>>
>> University of Maryland, Baltimore County
>> Sondheim Hall, 3rd Floor
>> 1000 Hilltop Circle
>> Baltimore, MD 21250
>>
>> Confidentiality Notice: This e-mail may contain information that is
legally privileged and that is intended only for the use of the addressee
(s) named above. If you are not the intended recipient, you are hereby
notified that any disclosure, copying of this e-mail, distribution, or
action taken in reliance on the contents of this e-mail and/or documents
attributed to this e-mail is strictly prohibited. If you have received this
information in error, please notify the sender immediately by phone and
delete this entire e-mail. Thank you.-----Original Message-----
>> From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of
>>
>> Tiffany
>> Sent: Friday, October 31, 2008 3:46 PM
>> To: SA...@LISTSERV.UGA.EDU
>> Subject: removing something extra on the end of variables
>>
>> Hi,
>>
>> I have imported data from excel into SAS. The field (hullnum) is set
>> to $10. but my value is 6 characters. I am matching this field to
>> another table with the same field (hullnum). I can see that the
>> values are the same, but they are not matching. When I check the
>> length of the two values, one is 7 characters (the one I imported from
>> excel) and the other is 6 characters as it should be. I have tried
>> trim(hullnum) and trim(left(hullnum)) trim(right(hullnum))
>> trim(left(right(hullnum))) but none work.
>>
>> when I query for this hullnum in my imported data using:
>> proc sql;
>> select * from data
>> where hullnum like 'ABCDEF%'
>>
>> then it shows up. I need that % on the end. So something extra is
>> there, I just can't figure out what it is and how to get rid of it.
>> Any ideas?
>>
>> thanks!
>
>that could work, but I have many rows with hullnum of variable
>lengths. I am not sure this will work on a large scale.
|