Sas

Asked • 04/20/19

how to concatenate each record within one observation in SAS?

I wonder whether it's possible to concatenate each record within one observation with SAS code. E.g. Here is the original data set **1st_name 2nd_name 3rd_name .....last_name** abc def ghi ..... xyz Now I want to add a variable that concatenates all values from 1st_name to last_name--separated by a specific separator, if possible. **Expected result** **1st_name 2nd_name 3rd_name .....last_name all_name** abc def ghi ..... xyz abcdefg...xyz Of course there is one way data name; set name; length all_name $ 30; all_name=1st_name||2nd_name....||last_name; run; However, things will get terrible if there are hundreds of variables. So the question has been how to do it automatically, without having to specify variable names, numbers etc. Looking forward to answers from SAS experts:)

1 Expert Answer

By:

Rick A. answered • 04/20/19

Tutor
5 (33)

Experienced SAS Professional

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.