Maybe using compute statement, but it is easier to create one variable using a data step:
data work.combined; set have; length combined $ 100; /* add the length of the variables to avoid data-loss */ combined = catx('\', site, subjid, race, ethnicity, sex); run;
If you want the data concatenated for a report, then it is a good idea to do this in a dataset before the proc report step. Have a variable specifically for the concatenated data say:
data want; set have; length demo $200; demo=catx("\",site,subjid,race,ethnicity,sex); run;
Then proc report that. Whilst proc report can do computed, you will want to have that information in the dataset you store for double programming/QC.
Example of desired output.
Otherwise we are likely to get many "that doesn't work" from you because we have to make a lot of assumptions about values involved.
In general, proc report is going to want a single "column" to be of the same type with a single format for each cell of the format with exceptions for computed summaries.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.