DATA Step, Macro, Functions and more

String manipulation

Accepted Solution Solved
Reply
Contributor
Posts: 56
Accepted Solution

String manipulation

Is there a function/routine in SAS to translate a list of unquoted inputs into an element wise quoted list. A crude example is shown below.

 

%let t1 = 20105 38163 5947127 10292;
%let t2 = %sysfunc(function(&t1.));

%put t2=&t2.;

t2="20105" "38163" "5947127" "10292"

This list is being input as a parameter to a macro, so I'm hoping to do this step as a input cleanse for use in a where/in statement on a character variable.

 

Thanks.


Accepted Solutions
Solution
‎02-15-2016 12:45 PM
Trusted Advisor
Posts: 1,117

Re: String manipulation

How about this?

%let t1 = 20105 38163 5947127 10292;
%let t2 = "%sysfunc(tranwrd(&t1., %str( ), %str(" ")))";
%put &=t2.;

View solution in original post


All Replies
Solution
‎02-15-2016 12:45 PM
Trusted Advisor
Posts: 1,117

Re: String manipulation

How about this?

%let t1 = 20105 38163 5947127 10292;
%let t2 = "%sysfunc(tranwrd(&t1., %str( ), %str(" ")))";
%put &=t2.;
Contributor
Posts: 56

Re: String manipulation

Posted in reply to FreelanceReinhard

I would not have know the quotes around the %sysfunc() would remain. Excellent. Thank you.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 173 views
  • 1 like
  • 2 in conversation