SCANQ - getting the error message

Reply
Frequent Contributor
Posts: 129

SCANQ - getting the error message

Hi,

following code is working with SAS 4.1 but now with SAS 4.3

(SCANQ(CALCULATED BID1, 1,"-")) AS ID

getting the following error message

ERROR: The following columns were not found as CALCULATED references in the immediate query: ID

please advice

Super Contributor
Posts: 349

Re: SCANQ - getting the error message

Hi,

Your variable has space ...so you try like this 'Calculated bid'n .

Thanks,

Shiva

Frequent Contributor
Posts: 129

Re: SCANQ - getting the error message

Hi Shiva,

Sorry I didn't get it... can you please retype the entire line

Thanks

Super Contributor
Posts: 349

Re: SCANQ - getting the error message

Hi,

x=scanq('calculated bid1'n,1,'-');

Thanks,

Shiva

Frequent Contributor
Posts: 129

Re: SCANQ - getting the error message

Thanks again Shiva.

I will give it a try and will let you know.

in a mean while can you please explain as what this function doing...

specially with n

Super Contributor
Posts: 349

Re: SCANQ - getting the error message

Hi,

''n is the sas way of reading the column names with spaces in between,if you dont specify this then sas will treat as two different variables.

you should also use

options validvarname=any;

Hope this helps.

Thanks,

Shiva

Occasional Contributor TD
Occasional Contributor
Posts: 13

Re: SCANQ - getting the error message

Hi,

If I understand correctly, this statement is part of SQL, not a variable name with space, therefore I'd suggest to check if BID1 is derived in the same SQL step.

My test on SAS 9.1.3 works fine:


data nametest;
   allnames='Eleanor "Billie Holiday" Fagan';
   array new(*) $16 name1 name2 name3;
   do i=1 to dim(new);
      new(i)=scanq(allnames,i," ");
   end;
run;


proc sql;
  select catx("-", name1, name2, name3) as bid1
    ,SCANQ(CALCULATED BID1, 1,"-") as id
      from nametest
    ;
quit;

It would be more helpful if you pasted all SQL statement.

Cheers

Ask a Question
Discussion stats
  • 6 replies
  • 517 views
  • 0 likes
  • 3 in conversation