Dear PGStats, Thanks for your prompt reply. Here's the example: to create a document for a planned study that contains: - two schools, 50 boys and 50 girls from each school - total 200 pupils. - for each group (e.g. school 1, 50 boys) to randomly assign a number and sort. The first 25 pupils get treatment and the next 25 pupils get control. What I've done is as follows: data a; do school=1,2; do gender='F','M'; do id=1 to 50; random=uniform(1); output; end;end;end; proc sort; by school gender random; run; data b; /*creating a vector of changing group values*/ do temp=1 to 4; do group='C','T'; do temp_1=1 to 25; drop temp temp_1; output; end;end;end; run; data all; merge a b; run; This works fine, but I was asked to do it in one document without merging an external document (I was given a tip of using count+1). Do you have an idea how to resolve this? Tremendous thanks
... View more