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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1391 views
  • 0 likes
  • 4 in conversation