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