@Kurt_Bremser wrote:
Yes, a DO will do this:
data want;
set have;
do i = 1 to frequency;
output;
end;
drop i;
run;
but you basically do not need this. SAS statistical procedures allow you to use frequeny as a WEIGHT variable.
Or sometimes FREQ variable. Depends on how it needs to be used. A demonstration for @nat_tha of difference between Weight and Freq.
data have;
input Obs Sex $ NoYes $ Frequency;
datalines;
1 Female Yes 5
2 Male No 3
3 Male Yes 2
4 Female Yes 3
;
proc tabulate data=have;
title 'Frequency as Weight';
class sex;
weight frequency;
var obs;
table sex, obs*(n mean std);
run; title;
proc tabulate data=have;
title 'Frequency as Freq';
class sex;
freq frequency;
var obs;
table sex, obs*(n mean std);
run; title;
Not all procedures have the distinction between Weight and Freq, but need to be aware if the option is available.
... View more