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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1816 views
  • 3 likes
  • 4 in conversation