Concatenate multiple column and add space
I want to concatenate multiple column to a new var as show below, adding space and other signs. I wrote a very long and a little complicated catx with many layers.
I wonder if you have a more straight forward and much simpler way to do this. Thank you in advance.
Obs | count | prev | CI_L | CI_H | Newvar |
1 | 22 | 1.2 | 0.7 | 1.8 | 1.2 (0.7-1.8) |
2 | 66 | 3.5 | 2.7 | 4.4 | 3.5 (2.7-4.4) |
3 | 121 | 6.4 | 5.3 | 7.6 | 6.4 (5.3-7.6) |
I think I figure out a simpler method using catx and cats. But if you have any other ideas, feel free to post and help whoever may look for an answer for the same question. Thanks.
If the source variables are numeric then you probably also want to use PUT() rather than just CATS() to convert them into strings. That will make sure the strings used to represent the numbers use consistent style.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: