So you have a string containing numbers, right? See this:
data have;
input year dividend $;
datalines;
2010 10
2011 11,15
2012 16
2013 20
;
data want;
set have;
do i = 1 to countw(dividend,',');
div_num = sum(div_num,input(scan(dividend,i,','),best32.));
end;
drop i;
run;
proc print data=want noobs;
run;
So you have a string containing numbers, right? See this:
data have;
input year dividend $;
datalines;
2010 10
2011 11,15
2012 16
2013 20
;
data want;
set have;
do i = 1 to countw(dividend,',');
div_num = sum(div_num,input(scan(dividend,i,','),best32.));
end;
drop i;
run;
proc print data=want noobs;
run;
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss. Register now and lock in 2025 pricing—just $495!