Hi:
I can't duplicate your error message. When I run this code:
[pre]
data testfile;
length BRPROV $15;
infile datalines;
input BRPROV $;
return;
datalines;
ALBERTA
SASKATCHEWAN
SASKATOON
MANITOBA
;
run;
data ifstmt;
set testfile;
IF SUBSTR(TRIM(LEFT(BRPROV)),1,7) = 'ALBERTA' OR
(SUBSTR(TRIM(LEFT(BRPROV)),1,12) = 'SASKATCHEWAN';
run;
[/pre]
I get a different error message from the mismatched parentheses in the second SUBSTR function. You have 3 open parens and 3 close parens in the test for ALBERTA, but you have 4 open parens and only 3 close parens in the test for SASKATCHEWAN.
[pre]
1386 data ifstmt;
1387 set testfile;
1388 IF SUBSTR(TRIM(LEFT(BRPROV)),1,7) = 'ALBERTA' OR
1389 (SUBSTR(TRIM(LEFT(BRPROV)),1,12) = 'SASKATCHEWAN';
-
79
ERROR 79-322: Expecting a ).
1390 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.IFSTMT may be incomplete. When this step was stopped there were 0 observations and 1
variables.
WARNING: Data set WORK.IFSTMT was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
[/pre]
And, when I run a PROC PRINT with a WHERE statement, I get the SAME error message about the mismatched parens.
[pre]
1395
1396 proc print data=testfile;
1397 WHERE SUBSTR(TRIM(LEFT(BRPROV)),1,7) = 'ALBERTA' OR
1398 (SUBSTR(TRIM(LEFT(BRPROV)),1,12) = 'SASKATCHEWAN' ;
-
79
ERROR 79-322: Expecting a ).
1399 title 'using WHERE statement';
ERROR: Syntax error while parsing WHERE clause.
1400 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
[/pre]
Rather than just posting partial code snippets, you may be helped more by contacting Tech Support and showing them your complete code, your entire SAS log. They can probably help you figure out the problem in a more timely fashion.
cynthia