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;
Ready to join fellow brilliant minds for the SAS Hackathon?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.