Hello ! Sorry for my english.. How can we create many macro variables using the BY VARIABLE... ? I have tried something like this : data test888;
set pourcomptage ;
by cniv1_cniv3 ;
if first.cniv1_cniv3 then do ;
call symputx("V1",col1);
end ;
if last.cniv1_cniv3 then do ;
call symputx('V2',sumcum);
end ;
run; The problem is that when i want to call the both macro variable, juste the last macro variable is stored. These 2 macro variables permit me to calculate later the difference : %let nrep = %eval(&v1 - &v2) and then, on a SQL QUERY, calculate by hand, a percent by variable (cniv1_cniv3). When I'm doing this : %let nrep = %eval(&V1 - &V2) ;
Proc sql ;
create table indi_cm as
select cniv1_cniv3, variable, (sum(count)/&nrep) as percent_mod
from nb_niv
group by cniv1_cniv3, variable ;
quit ; I don't know how to say : "for the first cniv1_cniv3 you take the first &nrep associate to this cniv1_cniv3" "for the second cniv1_cniv3, you take the second &nrep" ..... Do you have any idea ? I don't put an example of data because I think that you can help me without ! Thank you in advance... Onizuka
... View more