hi
i have
SR ID S S_G TS TS_G
1 19 1 5 7 2
2 20 5 8 6 1
3 21 5 7 2 1
i want
SR ID nw1 nw2
1 19 1 7
5 2
2 20 5 6
8 1
3 21 5 7
7 2
data want;
set have;
nw1 = s;
nw2 = ts;
output;
nw1 = s_g;
nw2 = ts_g;
output;
keep sr id nw1 nw2;
run;
data want;
set have;
nw1 = s;
nw2 = ts;
output;
nw1 = s_g;
nw2 = ts_g;
output;
keep sr id nw1 nw2;
run;
/*You want a dataset or report ?*/
data have;
infile cards;
input SR ID S S_G TS TS_G;
cards;
1 19 1 5 7 2
2 20 5 8 6 1
3 21 5 7 2 1
;
proc odstable data=have;
column SR ID (S TS)*(S_G TS_G);
define S;
header='nw1';
end;
define TS;
header='nw2';
end;
run;
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 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.