- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Appericiate if someone of you help me understand the problem with the code below.
Code:
else if (index(lowcase(filename),'_copied.csv') or (index(lowcase(filename),'_copied.xlsx') ) and "&function_compont" EQ 'NL' and (scan(lowcase(filename),5,'_') in ('5601','6010','6020')) then do;
Log:
else if (index(lowcase(filename),'_copied.csv') or (index(lowcase(filename),'_copied.xlsx') ) and "&function_compont" 108 ! EQ 'NL' and (scan(lowcase(filename),5,'_') in ('5601','6010','6020')) then do; SYMBOLGEN: Macro variable FUNCTION_COMPONT resolves to NL 108 else if (index(lowcase(filename),'_copied.csv') or (index(lowcase(filename),'_copied.xlsx') ) and "&function_compont" 108 ! EQ 'NL' and (scan(lowcase(filename),5,'_') in ('5601','6010','6020')) then do; ____ 22 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, ^, ^=, |, ||, ~, ~=.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Writing unstructured spaghetti crap like that will always get you in trouble.
I use the expletive on purpose here. If I saw such a line in production code, they would hear my yelling (while dressing down the **** who spit it out) in the CEO's office. Who works about half a mile (as the crow flies) from me.
Just slightly exaggerating.
See if this works for you:
else if
(
index(lowcase(filename),'_copied.csv') or
index(lowcase(filename),'_copied.xlsx')
) and
"&function_compont" EQ 'NL' and
scan(lowcase(filename),5,'_') in ('5601','6010','6020')
then do;
Of course, I had to make guesses about your logic.
Also make use of the features of the Enhanced Editor, which highlights closing brackets when the cursor is positioned before the opening bracket, and opening brackets if the cursor is positioned after a closing bracket.
But this all will only work for you if you make your code readable.
Maxim 12
Maxim 12
Maxim 12
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The first parenthesis is not closed.
I think you should remove the opening parentheis after the "or" :
or index(lowcase(....
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Writing unstructured spaghetti crap like that will always get you in trouble.
I use the expletive on purpose here. If I saw such a line in production code, they would hear my yelling (while dressing down the **** who spit it out) in the CEO's office. Who works about half a mile (as the crow flies) from me.
Just slightly exaggerating.
See if this works for you:
else if
(
index(lowcase(filename),'_copied.csv') or
index(lowcase(filename),'_copied.xlsx')
) and
"&function_compont" EQ 'NL' and
scan(lowcase(filename),5,'_') in ('5601','6010','6020')
then do;
Of course, I had to make guesses about your logic.
Also make use of the features of the Enhanced Editor, which highlights closing brackets when the cursor is positioned before the opening bracket, and opening brackets if the cursor is positioned after a closing bracket.
But this all will only work for you if you make your code readable.
Maxim 12
Maxim 12
Maxim 12
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here is your code copied from the log:
else if (index(lowcase(filename),'_copied.csv') or (index(lowcase(filename),'_copied.xlsx') ) and "&function_compont" EQ 'NL' and (scan(lowcase(filename),5,'_') in ('5601','6010','6020')) then do;
you miss an open parenthesis on first line - where it is closed on second line. Check is this what you meant. You don't need last pair of parenthesis.
else if ((index(lowcase(filename),'_copied.csv') or
(index(lowcase(filename),'_copied.xlsx') )
and "&function_compont" EQ 'NL' and
scan(lowcase(filename),5,'_') in ('5601','6010','6020')
then do;