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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1 reply
  • 814 views
  • 0 likes
  • 2 in conversation