I have a data set and I performed the following:
proc means data=mydata sum; var weight; output out=all sum=overall; run;
Now, I would like to "copy" the value of "sum", in another proc that is the following as the value of new_weight:
data test; if 0 then set test; if _n_=1 then do; YEAR=2015; HOSPITAL="A"; COUNTRY=.; new_weight="I need to add the value of sum from proc means as above"; output; end; set db; output; run;
I don't want to copy manually the value of the "sum" variable because it will take different values every time.
if _n_ eq 1 then set overall;;