The following is inherited from your code. If you like, but I recommend to use Astounding's code. %macro enrollment(rampdata=);
%let rampmo=%sysfunc(countw(&rampdata.,|));
%put &rampmo.;
%do i=1 %to &rampmo.;
%let ramp&i.=%scan(&rampdata.,&i.,|);
%let ramp&i.=%sysfunc(compress(&&ramp&i.));
%if &i=1 %then %let list=&ramp1 ;
%else %let list= &list , &&ramp&i ;
%put &&ramp&i.;
%end;
%put &list ;
%let rampsum=%sysfunc(sum( &list )); /* I know this is wrong, and I tried different way here. Can't figure it out. */
%put &rampsum ;
%mend enrollment;
%enrollment(rampdata=0|1|2|2|4|4|5|6|8|8|13|10|10);
0
1
2
2
4
4
5
6
8
8
13
10
10
0 , 1 , 2 , 2 , 4 , 4 , 5 , 6 , 8 , 8 , 13 , 10 , 10
Ksharp
... View more