You have the arguments to FIND() backwards. You are testing if DSNAME is exactly a single period.
Are there values of DSNAME that do not include a period?
What do you want to do in that case?
data test;
input dsname $32. ;
test1=substr(dsname,1,find(dsname,'.')-1);
test2=substrn(dsname,1,find(dsname,'.')-1);
test3=scan(dsname,1,'.');
put (_all_) (=/);
cards;
x.y
noperiod
.
;
dsname=x.y
test1=x
test2=x
test3=x
NOTE: Invalid third argument to function SUBSTR at line 244 column 9.
dsname=noperiod
test1=noperiod
test2=
test3=noperiod
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
250 noperiod
dsname=noperiod test1=noperiod test2= test3=noperiod _ERROR_=1 _N_=2
NOTE: Invalid third argument to function SUBSTR at line 244 column 9.
dsname=
test1=
test2=
test3=
251 .
dsname= test1= test2= test3= _ERROR_=1 _N_=3
NOTE: The data set WORK.TEST has 3 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.03 seconds
... View more