SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

using scan in a di studio file reader.

Accepted Solution Solved
Reply
Contributor
Posts: 38
Accepted Solution

using scan in a di studio file reader.

Hi all,

(I'm using DI Studio 4.901)

 

I'm trying to split a column of data i process with a file reader based on a delimiter into 2 new columns.

In EG this is easy to accomplish, but I cant seem to get this to convert over to my DIS transformation without an error.

 

my input column (web_atlas_ord_nbr) is a char20 with a pipe delimiter 

my 2 new result columns are char20 as well.

 

my expression code is: SCAN(web_atlas_ord_nbr, 1) for new result column1   and SCAN(web_atlas_ord_nbr, -1) for new result column 2.

 

it passes the validate expression check, but when I run it... I get a syntax error:

 

500 (SCAN (web_atlas_ord_nbr, 1)) as web# length = 20
_
22
200
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, ',', AS, FORMAT, FROM, INFORMAT, INTO, LABEL, LEN,
LENGTH, TRANSCODE.

ERROR 200-322: The symbol is not recognized and will be ignored.

 

 

I have attached some shots of the actual code and error.

Any help to understand what I'm doing worng would be greatly appreciated.

 

 

 

 

 

 

 

- Chris N.

Accepted Solutions
Solution
‎09-28-2017 10:28 AM
Super User
Super User
Posts: 7,938

Re: using scan in a di studio file reader.

[ Edited ]

You need to post the SAS log records into a code block (use teh {i} icon on the editor tool bar) so we can see what character SAS is trying to underline that is causing the error.

 

To me it looks like you have a problem with the name of the target variable.

web#

is not a valid variable name.

 

You also can clean up the code for the SCAN function.  You should tell it what your delimited is. Also if the source field only has one value in its list your second query will store capture it instead of generating blanks.  Your probably want more like this:

scan(x,1,'|')
scan(x,2,'|')

View solution in original post


All Replies
Solution
‎09-28-2017 10:28 AM
Super User
Super User
Posts: 7,938

Re: using scan in a di studio file reader.

[ Edited ]

You need to post the SAS log records into a code block (use teh {i} icon on the editor tool bar) so we can see what character SAS is trying to underline that is causing the error.

 

To me it looks like you have a problem with the name of the target variable.

web#

is not a valid variable name.

 

You also can clean up the code for the SCAN function.  You should tell it what your delimited is. Also if the source field only has one value in its list your second query will store capture it instead of generating blanks.  Your probably want more like this:

scan(x,1,'|')
scan(x,2,'|')
Contributor
Posts: 38

Re: using scan in a di studio file reader.

Tom,

as soon as I read your reply I realized the issue. I had this problem a while back when I tried to use the '#' as part of a column name. I changed it to _nbr for each new column and re-ran my code.. and it worked.
thanks for the help.. !
- Chris N.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 234 views
  • 0 likes
  • 2 in conversation