From: Anaconda on
Hi,
I do have some trouble finding an error in my code.
I don't fully understand what SAS is trying to tell me.
Here is the code:



data saslog_ekstrakt_sekvensiell;
length Type $12.;
length Spraak_Komponent $15.;
Type = " ";
Spraak_Komponent = " ";
set saslog_komplett_sekvensiell;
label
Type = "Meldingstype"
Spraak_Komponent = "Kategori språk"
;

if index(Logglinjetekst,"ERROR ") >
0 and
( index(Logglinjetekst,
"_ERROR_=1"
> 0 or
index(Logglinjetekst, "All variables in array list must be
the same type, i.e., all numeric or character") > 0 or
index(Logglinjetekst, "Alphabetic prefixes for enumerated
variables are different") > 0 or
( index(Logglinjetekst,"Array subscript out of range at
line") > 0 and
index(Logglinjetekst,
"column") > 0
)
or
index(Logglinjetekst, "BY variables are not properly
sorted on data set") > 0
or
index(Logglinjetekst, "Data set is not sorted in ascending
sequence") > 0 or
index(Logglinjetekst, "Data set is not sorted in
descending sequence") >
0 or
( index(Logglinjetekst, "Data
set") > 0 and
index(Logglinjetekst, "is not sorted in ascending
sequence") > 0
)
or
index(Logglinjetekst, "No CARDS or INFILE
statement"
> 0 or
index(Logglinjetekst, "is not allowed in the DATA
statement" >
0 or
( index(Logglinjetekst, "Variable") > 0 and
index(Logglinjetekst, "not found") > 0
)
or
index(Logglinjetekst, "Expecting an relational or
arithmetic operator") >
0 or
index(Logglinjetekst, "Syntax error, statement will be
ignored") > 0 or
index(Logglinjetekst, "The symbol is not recognized and
will be ignored") > 0 or
index(Logglinjetekst, "Syntax error, expecting one of the
following:") > 0 or
index(Logglinjetekst, "Statement is not valid or it is
used out of proper order") > 0
)
then do;
Type = "ERROR";
Spraak_Komponent = "SAS språk";
output;
end;

run;






And this is what comes out in the log:

38
9239 data saslog_ekstrakt_sekvensiell;
9240 length Type $12.;
9241 length Spraak_Komponent $15.;
9242 Type = " ";
9243 Spraak_Komponent = " ";
9244 set saslog_komplett_sekvensiell;
9245 label
9246 Type = "Meldingstype"
9247 Spraak_Komponent = "Kategori språk"
9248 ;
9249
9250 if index(Logglinjetekst,"ERROR ") >
0 and
9251 ( index(Logglinjetekst,
"_ERROR_=1"
> 0 or
9252 index(Logglinjetekst, "All variables in array list
must be the same type, i.e., all numeric or character") > 0
or
9253 index(Logglinjetekst, "Alphabetic prefixes for
enumerated variables are different") >
0 or
9254 ( index(Logglinjetekst,"Array subscript out of
range at line") > 0 and
9255 index(Logglinjetekst,
"column") > 0
9256 )
or
9257 index(Logglinjetekst, "BY variables are not
properly sorted on data set")
> 0 or
9258 index(Logglinjetekst, "Data set is not sorted in
ascending sequence") >
0 or
9259 index(Logglinjetekst, "Data set is not sorted in
descending sequence") >
0 or
9260 ( index(Logglinjetekst, "Data
set") > 0 and
9261 index(Logglinjetekst, "is not sorted in
ascending sequence") > 0
9262 )
or
9263 index(Logglinjetekst, "No CARDS or INFILE
statement"
> 0 or
9264 index(Logglinjetekst, "is not allowed in the DATA
statement" >
0 or
9265 ( index(Logglinjetekst, "Variable") > 0 and
9266 index(Logglinjetekst, "not found") > 0
9267 )
or
9268 index(Logglinjetekst, "Expecting an relational or
arithmetic operator") >
0 or
9269 index(Logglinjetekst, "Syntax error, statement will
be ignored") > 0
or
9270 index(Logglinjetekst, "The symbol is not recognized
and will be ignored") > 0
or
9271 index(Logglinjetekst, "Syntax error, expecting one
of the following:") > 0
or
9272 index(Logglinjetekst, "Statement is not valid or it
is used out of proper order") > 0
9273 )
9274 then do;
----
22
76
ERROR 22-322: Syntax error, expecting one of the following: !, !!,
&, ), *, **, +, ',', -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT,
IN, LE, LT, MAX, MIN, NE, NG, NL, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.

ERROR 76-322: Syntax error, statement will be ignored.

9275 Type = "ERROR";
9276 Spraak_Komponent = "SAS språk";
9277 output;
9278 end;
---
161
ERROR 161-185: No matching DO/SELECT statement.

9279
9280 run;

NOTE: Character values have been converted to numeric values at the
places given by: (Line):(Column).
9251:35 9263:35 9264:35
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.SASLOG_EKSTRAKT_SEKVENSIELL may be
incomplete. When this step was stopped there were 0 observations and
4 variables.
WARNING: Data set WORK.SASLOG_EKSTRAKT_SEKVENSIELL was not replaced
because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.01 seconds


May be it can be the parenthesis in the if-then-do construction that
is wrong, but I really can't find the bug.

- Anaconda

From: Patrick on
If I see that right then the closing bracket after
[ index( index(Logglinjetekst,"_ERROR_=1" ] is missing.

The error message tells you that something is missing; a closing
bracket is even in the list.

ERROR 22-322: Syntax error, expecting one of the following: !, !!,
&, ), *, **, +, ',', -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT,
IN, LE, LT, MAX, MIN, NE, NG, NL, NOT, NOTIN, OR, ^, ^=, |, ||, ~,
~=.


HTH
Patrick