Please help me with code.
I'd like to get table with 2 columns: title1 & last value in a row (in i.e. bold) = last column with value from title2 to title_n. Number of columns is not known, it can be 100 or more.
title1 | title2 | title3 | title4 | title5 |
B643B0C | B643B0C | 3090E43 | BCC0E18 | 8F2E437 |
EF6E8A4 | EF6E8A4 | |||
D1CA75B | D1CA75B | 8AF3241 | DC24E41 | |
30CCDFB | 30CCDFB | 379E9CF | ||
E498CD8 | E498CD8 | |||
58CB971 | BD6A93E | BD6A93E | ||
27B35FC | 27B35FC | C4F7E5D | 4F507FE | 8F00A10 |
EA06B97 | EA06B97 | BD6A93E | 11692E8 | |
ADFD3E7 | ADFD3E7 | 1794801 | ||
1B43CC4 | 1B43CC4 | 984A9CE | 2F9769A | 1540CC5 |
Hope for your help.
please try coalescec
data want;
set have;
last=coalescec(of title5-title2);
keep title1 last;
run;
please try coalescec
data want;
set have;
last=coalescec(of title5-title2);
keep title1 last;
run;
Jagadishkatam, thank you so much, it works!
Hi @J_J_J
data have;
infile cards truncover;
input (title1 title2 title3 title4 title5) (:$10.);
cards;
B643B0C B643B0C 3090E43 BCC0E18 8F2E437
EF6E8A4 EF6E8A4
D1CA75B D1CA75B 8AF3241 DC24E41
30CCDFB 30CCDFB 379E9CF
E498CD8 E498CD8
58CB971 BD6A93E BD6A93E
27B35FC 27B35FC C4F7E5D 4F507FE 8F00A10
EA06B97 EA06B97 BD6A93E 11692E8
ADFD3E7 ADFD3E7 1794801
1B43CC4 1B43CC4 984A9CE 2F9769A 1540CC5
;
data want;
set have;
array t(*) title:;
want=choosec(dim(t)-cmiss(of t(*)),of t(*));
run;
Thanks
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.