- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 08-06-2020 01:14 AM
(1366 views)
Hi, Is there a better way to concatenate all these variables that starting with a variable name var and a value attached?
Eg.
var1
var2
var3
var4
var5
This is what I got now, but would pick up variables like var_ which not needed.
var_conc= catx(',', of var:);
Thanks
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Provided, that your posted data is representable, you could do
data have;
input (var1 var_1 var2 var_2 var3 var_3)($);
datalines;
a b c d e f
;
data want;
set have;
var_conc = catx(',', of var1-var3);
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks but this is what I have and need:
data want;
keep skill:;
set have;
How do I concatenate all the skill variables?
data want;
keep skill:;
set have;
How do I concatenate all the skill variables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Why do you change your question half-way?
What exactly do you want? To keep the SKILL: variables but not the SKILL_: variables?
Show us the proc contents of your table, and describe exactly what you want to concatenate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I've got a long list of skill1, skill2, skill3, skill4, etc variables and need to concatenate all these variables to one. There's a variable skill_ which is not required.
Thanks
Thanks