DATA Step, Macro, Functions and more

Add a suffix to a varable

Accepted Solution Solved
Reply
Contributor CEG
Contributor
Posts: 25
Accepted Solution

Add a suffix to a varable

Hi,

 

I just want to add a "1" to variables called "segment."   They look like "ABC," ....."XYZ."

 

I was wondering why this doesn't work:

 

If carrier = 'CTL' then segmentplus = segment || "1";

 

I get ABC not ABC1.

 

 

Thanks.


Accepted Solutions
Solution
‎03-07-2017 05:22 PM
Super User
Posts: 19,869

Re: Add a suffix to a varable

Length of the variables. Try using a CATT function that strips trailing and leading spaces.

 

If carrier = 'CTL' then segmentplus = catt(segment, 1);

View solution in original post


All Replies
Solution
‎03-07-2017 05:22 PM
Super User
Posts: 19,869

Re: Add a suffix to a varable

Length of the variables. Try using a CATT function that strips trailing and leading spaces.

 

If carrier = 'CTL' then segmentplus = catt(segment, 1);
Contributor CEG
Contributor
Posts: 25

Re: Add a suffix to a varable

Thanks for the quick response.   It works!

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 146 views
  • 0 likes
  • 2 in conversation