Help using Base SAS procedures

PROC SQL: concatenate column with string

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

PROC SQL: concatenate column with string

Hi All,

Below I am trying to concatenate the string 'Prospective Targeted' with field INT_YEAR. When I run the program I get error '

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

 

 

SELECT

MEMBER_HCID

,MAX(CASE WHEN T2.HC_ID IS NOT NULL THEN 'Prospective Targeted'||''|| INT_YEAR ELSE 'NOT TARGETED' END) AS Prospective_Target


Accepted Solutions
Solution
‎06-02-2017 08:49 AM
Super User
Posts: 11,343

Re: PROC SQL: concatenate column with string

[ Edited ]
Posted in reply to BrianConner

Apparently your year variable is numeric.

 

Try

  catx(' ','Prospective Targeted',INT_YEAR )

instead.

 

The concatenation functions generally have better behavior than || concatenation operator.

View solution in original post


All Replies
Solution
‎06-02-2017 08:49 AM
Super User
Posts: 11,343

Re: PROC SQL: concatenate column with string

[ Edited ]
Posted in reply to BrianConner

Apparently your year variable is numeric.

 

Try

  catx(' ','Prospective Targeted',INT_YEAR )

instead.

 

The concatenation functions generally have better behavior than || concatenation operator.

☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 11082 views
  • 1 like
  • 2 in conversation