BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi all,

I've been looking through the help guide and I can't seem to find anything on merging the data in two columns together. What I am trying to do is attach the data in column B to that in column A so I only have one column..

For example, at the moment my data is separated like:

First Name (Column A) Last Name (Column B)
John Smith

But I want:

Name (Column A)
John Smith

It's probably so simple and obvious but I can't for the life of me figure it out. I don't mind whether the advice is for the Query Builder or for code.

Thanks in advance!
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Have a look at using the CATT function (new with SAS 9) with assigning a new SAS CHARACTER type variable in a DATA step (after declaring a LENGTH statement for the new variable).

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
I just worked it out. For anyones' future reference I used:

TRIM(Column A)||' '||TRIM(Column B)


Thanks for your response Scott.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Glad to see you worked it out. The CATX function in SAS 9 can simplify your code somewhat by handling the first variable TRIM (the second is unnecessary) and by coding your separator string as argument1 presented to CATX.

Scott

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 827 views
  • 0 likes
  • 2 in conversation