02-28-2014 05:44 PM
Probably a common problem, and I'm just blanking on a solution that doesn't require 5,040 lines of code...
I have seven variables, of which any number of them can be populated or missing. In any combination. And I'd like to concatenate them into a single variables that displays the populated values as a list separated by commas. But obviously I don't want extraneous commas, so I only want the new variable to include non-missing values. Any thoughts on how to do this?
Desired new variable:
|1||Child, Funding, Title IV-E|
|2||Funding, Courts, Team|
|3||Policy, Team, Other|
|6||Child, Courts, Title IV-E, Other|
02-28-2014 05:56 PM
Oh, duh. It really is a Friday isn't it... where is my brain? I'm so used to using the long-hand version with the concatenation operator I completely forgot about the catx function. Thanks!
(That's 2 for 2 today, Reeza.)
02-28-2014 05:55 PM
I would start with CATX function in a data step
length combinedBarriers $ <big enough integer to store longest combination>;
combinedbarriers = catx(',' of Barrier1-Barrier7);
Need further help from the community? Please ask a new question.