@Babloo wrote:
@Patrick two questions a) How to tweak your solution without creating the new macro variable, 'parameter_new'? b) In the below code block, you've hardcoded the values but in real life the values of macro variable will change and it can have any special/invisible characters.
%let parameter=Data Management,Operations,Sales ;
/* construct value for macro variable parameter that includes blanks, a tab and a line feed */
data _null_;
call symput('parameter',cat('Data','0A'x,' Management , ','09'x,' Operations , Sales '));
run;
On a separate note, I'd like to know how to handle if we have multibyte characters or single quotes in the macro variable values.
In above block I'm creating and populating macro variable parameter with some extra spaces, a tab and an line feed. That's the "Have" to mimic what you describe you're dealing with.
The 2nd data step then replaces any invisible character to a blank. The \s meta character in the RegEx is used for this.
If you have multibyte characters then we can't use RegEx that in the SAS implementation only works for single byte character sets. So would need to code this differently.
Dealing with single quotes would be possible with a bit more extra logic.
...trying to provide you a solution to a real problem so not really motivated to spend time for a fully generic approach.
... View more