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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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