BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hhchenfx
Rhodochrosite | Level 12

Hi Everyone,

 

I have few string var1 var2 var3.

I want to add all 3 strings and between each string, I want to have 3 spaces.

 

I try:      new_var=cats(var1, "   ", var2, "   ", var3)

 

But it doesn't work.

 

Any suggestion, please.

 

Thank you.

 

HHCFX

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

use catx

 

  new_var=catx( "    ", var1,var2,var3)

View solution in original post

4 REPLIES 4
novinosrin
Tourmaline | Level 20

use catx

 

  new_var=catx( "    ", var1,var2,var3)

andreas_lds
Jade | Level 19

The function cats uses strip+trim on each argument, so nothing is appended. Using catx - as suggested by @novinosrin - solves the issue.

singhsahab
Lapis Lazuli | Level 10

Hello,

 

You have to use catx function as suggested by 

 

hhchenfx
Rhodochrosite | Level 12
Thanks a lot.
HHC

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1689 views
  • 3 likes
  • 4 in conversation