BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jen123
Fluorite | Level 6
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.
1 ACCEPTED SOLUTION

Accepted Solutions
DBailey
Lapis Lazuli | Level 10
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

View solution in original post

5 REPLIES 5
DBailey
Lapis Lazuli | Level 10
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
jen123
Fluorite | Level 6
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!
DBailey
Lapis Lazuli | Level 10
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
jen123
Fluorite | Level 6
That worked! Thanks very much.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 25086 views
  • 2 likes
  • 3 in conversation