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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1246 views
  • 0 likes
  • 2 in conversation