```Date: Wed, 3 Feb 2010 12:07:48 -0800 Reply-To: ChrisG Sender: "SAS(r) Discussion" From: ChrisG Organization: http://groups.google.com Subject: macro problem Comments: To: sas-l@uga.edu Comments: cc: godlewski@unistra.fr Content-Type: text/plain; charset=ISO-8859-1 Hello all After spending a long time searching for a clue around here without success I am submitting you my (probably easy & dumb) problem Here is what works well with my data: data b; set a; by id_bb year month; if t > 0 then d0=mmwspread/((1+libor)**(t)); else d0=0; if t - 1 > 0 then d1=mmwspread/((1+libor)**(t-1));else d1=0; if t - 2 > 0 then d2=mmwspread/((1+libor)**(t-2));else d2=0; if t - 3 > 0 then d3=mmwspread/((1+libor)**(t-3));else d3=0; if t - 4 > 0 then d4=mmwspread/((1+libor)**(t-4));else d4=0; if t - 5 > 0 then d5=mmwspread/((1+libor)**(t-5));else d5=0; if t - 6 > 0 then d6=mmwspread/((1+libor)**(t-6));else d6=0; run; now the issue is that in the initial data i had t = 1 to 7 (t is for a time period) now in the big dataset i have t = 1 to 126 !!! so instead of typing 125 lines of sas code i tried to do a macro something like this: %macro a; %do t=1 %to 126; %do i=0 %to 125; data b; set a; by id_bb year month; if &t-&i > 0 then d&i= mwspread/((1+_mlibor)**(&t-&i)); else d&i=0; output; %end; output; %end; %mend; %a; the problem is that this macro is not "appending" the d&i variable but puts the newest value of d&i in the palce of the old one at the end i get just the d125 in the data but i want to have the d0 until d125 could you help me out please ? thanks in advance Cheers CG ```

Back to: Top of message | Previous page | Main SAS-L page