Why do you want to do this? For reporting purposes?
A first step to create the concatenated variables can be this:
proc sql;
create table want as
select
a.country,
cats(a.tr1,'(',b.tr1,')') as tr1,
cats(a.tr2,'(',b.tr2,')') as tr2,
cats(a.tot,'(',b.tot,')') as tot
from
(select country,tr1,tr2,tot from new where name ='Count') a
inner join
(select country,tr1,tr2,tot from new where name ='Percent') b
on a.country = b.country;
quit;
@sasuser123123 wrote:
Hello!
I've data like
Data new;
Input Country$ Name$ Tr1 Tr2 Tot;
Cards;
EUR Count 3 6 9
EUR Percent 15 30 45
NOA Count 7 4 11
NOA Percent 35 20 55
;
So Need output like....
COUNTRY TR1 TR2 TOT
EUR 3(15) 6(30) 9(45)
NOA 7(35) 4(20) 11(55)
Could anyone please help me that how to do this task..
Thank you...
Regards.
If that data structure is the result of summarizing something it might be better off to go back to a raw form of the data and create the report you want directly. If this is the case can you provide an example of the raw data before that summary?
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.