Any one can help explain when to put % in if then statement , for example %if *** %then %do. In the example below, should I use % or not in if then statement. One more question, can I use "Do i = 1 to n while (condition)" statement here like this? It’s not array, they are all observations in the data sets. %MACRO FUNDSOURCE(I); DATA SASDATA.STUDENT&I; SET SASDATA.STUDENTLIST DO M = 1 TO 310 WHILE(&&BUDG&I > 0); /*loop through all observations_ALL STUDENTS*/ IF &&BUDG&I LE 3000- FA_TOT THEN do; DISBURSE = &&BUDG&I; FA_TOT +DISBURE; &&BUDG&I - DISBURSE; end; ELSE IF &&BUDG&I GT (3000- FA_TOT) THEN DO; DISBURSE = 3000-FA_TOT; FA_TOT + DISBURSE; &&BUDG&I - DISBURSE; END; END; IF _n_ > M THEN DELETE; /*if budget are all gone, delete other observations, keep observations only for the student who get funds*/ RUN; %MEND FUNDSOURCE;
... View more