Desktop productivity for business analysts and programmers

ERROR: Concatenation (||) requires character operands.

Reply
Learner
Posts: 1

ERROR: Concatenation (||) requires character operands.

[ Edited ]

hi everyone,

 

PROC SQL NOEXEC;
   SELECT (MAX(CASE WHEN(d1= 'C' AND d2= 'X') 
         THEN sutun1||' '||sutun2 ELSE ' ' END)) AS CALCULATION
      FROM BB2.Ott t1;
QUIT;

 

ERROR: Concatenation (||) requires character operands.

 

what's my fault?

thaks Smiley Happy

Super User
Posts: 23,998

Re: ERROR: Concatenation (||) requires character operands.

Posted in reply to KirLiSakaL

Exactly what it says, your variables should be character but they're numeric. 

 

You can use CATX instead, but it converts numbers using the BEST format so verify it gives you what you want.

Super User
Super User
Posts: 9,839

Re: ERROR: Concatenation (||) requires character operands.

Posted in reply to KirLiSakaL

What is it your actually trying to do as there are various issues with your code.  First, you have the problem as given by @Reeza, you are concatenating (a string function) numeric variables.  Secondly, you are max()ing (a numeric function) on character data.  

Provide a small bit of test data and show what you want out, maybe something like:

proc sql noexec;
  select  max(coalesce(SUTUN1,SUTUN2)) as CALCULATION
  from    (select * from BB2.OTT where D1="C" and D2="X");
quit;
Ask a Question
Discussion stats
  • 2 replies
  • 906 views
  • 1 like
  • 3 in conversation