@ballardw
My real data has 200 items, and "divided" into 4 blocks as following
block 1: name_item1-name_item50
block 2: name_item51-name_item100
block 3: name_item101-name_item150
block 4: name_item151-name_item200
When administer the test, the order of item name (name_item:) is different within each block for different candidates taking the same form_name. My purpose is after reordering item name, for candidates taking the same form_name, the order of item name are the same for all 200 items.
In my real data, I added candidate id as in the following code
data temp;
set have;
array n name_:;
length item $ 10;
do i= 1 to dim(n);
item = n[i];
output;
end;
keep formname id item;
run;
proc sort data=temp;
by formname id item;
run;
data temp2;
set temp;
/* the magin number 3 is the original number of
name_item variables in the starting data
replace ALL of the 3 with that number
*/
array name_item(200) $ 10;
retain name_: ;
index = mod(_n_,200)+(200*(mod(_n_,200)=0)) ;
name_item[index]=item;
if index=200 then output;
keep form_name id name_: ;
run;
In "temp2" data I got, item order in the first block, that is, "name_item1" to "name_item50" are the same for all test taker and across all form_name, which is desired. But the item order of the rest three blocks are not quite what I wanted, in other words, item order in the 2nd block ( "name_item51" to "name_item100") are the same within each block but different across form_name. Same results to the 3rd and 4th blocks.
Could you please modify your code to help get the desired results I wanted.
Thank you!!
... View more