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

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 1900 views
  • 0 likes
  • 2 in conversation