🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: bit.listserv.sas-l
1 messages
1 total messages Started by mySASLacct Fri, 23 Jun 2006 18:07
SAS left function documentation
#2201
Author: mySASLacct
Date: Fri, 23 Jun 2006 18:07
39 lines
2284 bytes
Hi All,

    I'm curious about one of the most elementary SAS functions: LEFT.
In the 'old days', I always made sure I used 'trim(left(var))' rather
than 'left(trim(var))' due to the specific wording of the SAS
documentation regarding LEFT (i.e., "Converts leading blanks to
<u>trailing</u> blanks"). That, in combination with the order of
operations, seemed to lead to some trailing blanks being kept (at least
from recalling way back to v6.12) when using "left(trim(var))" - I
think.

    So, I've been merrily about my way using "trim(left(var))" for
years and noticed today that the left function (at least in my setup in
v8.2) seems to be accomplishing exactly the same thing that
"trim(left(var))" always has, in that it's getting rid of both leading
AND trailing blanks.

e.g.,

data test;
     var="     xx    ";
     tlvar=trim(left(var));
     lvar=left(var);

     lenvar=length(var);
     lentlvar=length(tlvar);
     lenlvar=length(lvar);
run;


proc print data=test;
     where tlvar=lvar;
     title 'HOLY COW, THIS PARACHUTEs A NAPSACK!';
run;

So, (1) Is this real or am I missing some technical detail, &
      (2) Why does the documentation not mention this?

thanks!
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads