|Date: ||Thu, 27 Jun 2002 15:47:52 -0400|
|Reply-To: ||Sigurd Hermansen <HERMANS1@WESTAT.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Sigurd Hermansen <HERMANS1@WESTAT.COM>|
|Subject: ||Re: INDEX question|
|Content-Type: ||text/plain; charset="iso-8859-1"|
Don't feel alone in failing to recognize that the SAS compiler would treat
the blanks used to pad the column variable space as significant in the
INDEX() comparison. From this I would infer that the string assigned to
lname_dmv includes the training blanks. The SAS V6 manual and V8 on-line
documentation do not mention this caveat.
A good question for a concepts exam, I'd say, would be one that asks how SAS
defines strings (the term used in documentation) for purposes of matching.
It appears to me that SAS defines a string as the full contents of a
fixed-width storage location referenced by the name of a column variable,
including blanks used to pad out the storage location. This means that good
SAS programming practice must include trimming of trailing blanks if the
value assigned to a column variable does not fill out the length of the
location where SAS stores the string.
From: Robert Matthews [mailto:rsm@UAB.EDU]
Sent: Thursday, June 27, 2002 2:11 PM
Subject: INDEX question
Can someone please offer some insight into this code. I've used the index
function for years, but when I run this program, I expect the value of L2
and F2 to equal 1. Yet the values are zero. I don't understand what is
I'm using v8.2 on Win 2k PRO.
length lname lname_dmv $20 fname fname_dmv $15;
input fname lname fname_dmv lname_dmv;
put l1= l2= f1= f2= lname= lname_dmv= fname= fname_dmv=;
VICTORIA GRADDYWHITE VICTORI GRADDY