BookmarkSubscribeRSS Feed
bignate1030
Fluorite | Level 6

I simply want to copy the values from one variable onto the end of the values from another variable. I have some sample data:

 

time_frame          var1

100days              293

6months              651

1year                   307

 

And I want the end result to be 

 

time_frame       var1

100days293     293

6months651     651

1year307          307

5 REPLIES 5
bignate1030
Fluorite | Level 6

Is there a way that I can input a hyphen or an underscore in between the time_frame and var1 values using the cats function?

Such as 6months_651?

Reeza
Super User

CATX() instead of CATT().

 


@bignate1030 wrote:

Is there a way that I can input a hyphen or an underscore in between the time_frame and var1 values using the cats function?

Such as 6months_651?


 

ballardw
Super User

What is the defined length of your Time_frame variable? Is it going to be long enough to add on the entire value of var1?

 

If the defined length is less than 10 then you can't add anything onto 100days (7 characters) and would need to create a new variable as adding 3 more characters means you need 10 characters to hold the value.

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

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1532 views
  • 0 likes
  • 4 in conversation