BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AnissaG
Calcite | Level 5

Hi All - Long time lurker, first time poster. Normally googling is enough to answer any questions I have, but I'm having a hard time locating this one (I'm worried it's because the answer is so obvious no one ever bothers to ask). Apologies in advance as I fumble through this. 

 

In my work, I use SAS Enterprise Guide 7.1, relying mostly on the query building tool, but I occasionally mix in programs where the ask is beyond the standard Enterprise Guide functionality. I'm self taught so my knowledge is pretty remedial. I'm trying to build a step where I can concatenate a series of columns in addition to including other non-concatenated columns. I don't want to do it in the Query Builder because this is a project I run regularly and the number of columns might vary from project to project, so I'm trying to take out the manual-aspect of it. 

 

I've figured out how to do the CAT step, but being a programming newbie I'm not sure how to incorporate an additional column (outside of the CATX), my output is just the CATX column. 

 

I have googled the heck out of it, and I'm sure it's something simple, but because I'm self taught I think I'm just not experienced enough to figure it out. 

 

 

What I have: 

COLUMNA | Column1 | Column2|Column 3


What I want:

COLUMNA | CATX(COLUMNS1-3)

 

What I am getting:

CATX(COLUMNS1-3)

 

Here's my code to get the last one, I just need to figure out how to bring COLUMNA in, in addition to my concatenated column which is coming through great:

 

data WANT (keep=Column);
length Column $200;
set HAVE;
Column = catx(',',of Column:);
run;

Thanks in advance for any help you might be able to offer, and sorry again if this is a super remedial question. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Your resulting file only contains the column named COLUMN because you told SAS to ONLY keep that column

data WANT (keep=Column);

If you wanted to keep everything, just use:

data WANT;

Art, CEO, Analyst Finder.com

View solution in original post

1 REPLY 1
art297
Opal | Level 21

Your resulting file only contains the column named COLUMN because you told SAS to ONLY keep that column

data WANT (keep=Column);

If you wanted to keep everything, just use:

data WANT;

Art, CEO, Analyst Finder.com

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 1370 views
  • 0 likes
  • 2 in conversation