Desktop productivity for business analysts and programmers

Concatenate - Operand

Reply
Frequent Contributor
Posts: 94

Concatenate - Operand

Hi,

I have 3 columns in a dataset I would like to combine into one column. I used the CONCATENATE function, but kept getting an error that "CONCATENATE REQUIRES CHARACTER OPERANDS". Below is part of the error log. Any advice regarding line 15?
Thanks!

***********************

/* Concatenate */
15 (Name=Event_Month || Operators || Queue_Name) AS Concatenate
16 FROM WORK._2011_05_11_COMBINED_NCL_BY_QUEU AS t1
17 GROUP BY t1.Site, t1.Event_Month, t1.OPERATORS, t1.QUEUE_NAME, (CALCULATED Concatenate);
ERROR: Concatenation (||) requires character operands.
ERROR: The following columns were not found in the contributing tables: Name.
Super Contributor
Posts: 578

Re: Concatenate - Operand

I'm presuming event_month is a numeric variable. You'll need to use the put command to convert it to character as in
put(event_month,z2.0)||operators||queue_name
Frequent Contributor
Posts: 94

Re: Concatenate - Operand

THanks for the help! I am a brand new user...with very little programming background.

Event_month is Date9.

I used your code below and the results are the name of the operators and queue name....no event month.

Thanks again!
Super Contributor
Posts: 578

Re: Concatenate - Operand

What format do you want the event_month to be in your concatenated string? Just put that in the put command.

put(event_month,yymmdd8.)||operators||queue_name
Frequent Contributor
Posts: 94

Re: Concatenate - Operand

That worked! Thanks very much.
Super Contributor
Super Contributor
Posts: 3,174

Re: Concatenate - Operand

Also, you may want to consider the CAT functions (there are several) depending on the desired result (SAS behavior, such as automatic trim) - CATT, CATS, CATX.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 5 replies
  • 14898 views
  • 2 likes
  • 3 in conversation