|
From: Winter on 30 Mar 2010 09:37 Hi, there are two things I am trying to do with random numbers that I am having trouble with. Can anyone help me get started? Everything I've read online has been pretty complex... 1. I have 15 people who need to be assigned to either task 1, 2, or 3. They will only do one task and I want equal group sizes. 2. I have 10 people who will be doing all three tasks, but the order in which they do them needs to be randomly assigned (1,2,3 or 1,3,2 etc.). Here the number of people doesn't matter since there are six possible orders. Do I need to make this like the previous problem where I would basically assign the 10 people to condition 1-6, or is there a way to get SAS to do the ordering itself? Thanks so much for the help!
From: tanwan on 30 Mar 2010 11:33 On Problem 2, I think getting SAS to do the ordering is possible, but it would probably take a lot more effort. In this code, I assign each distinct permutation a distinct code, and randomly assign the person a code. Simply put, need to assign each person a code 0 thru 5 RANDOMLY. S/he who gets a 0 gets order 123; code 1 gets 321; et cetera. data ten10; do Id=101 to 110; output;end; proc print;run; proc format; value orderF 0="1,2,3" 2="1,3.2" 4="3,1,2" 1="3,2,1" 3="2,3,1" 5="2,1,3" ; data ten10 (drop=xx); set ten10; xx= mod( int(ranuni(28745)*10 ), 6); /* change the seed here=28745 to get another random assignment */ order_=put (xx, orderF.); label order="Order of Assignment"; proc print label;run; On Problem 1, I think PROC SURVEYSELCT can do it, but perhaps not. T!
From: Andrew Karp Sierra Info Services on 30 Mar 2010 13:18 Doesn't good old PROC PLAN offer these tools, too? Andrew Karp Sierra Information Services http://www.sierrainformation.com On Mar 30, 8:33�am, tanwan <tanwanz...(a)yahoo.com> wrote: > On Problem 2, I think getting SAS to do the ordering is possible, but > it would probably take a lot more effort. In this code, I assign each > distinct permutation a distinct code, and randomly assign the person a > code. Simply put, need to assign each person a code 0 thru 5 RANDOMLY. > S/he who gets a 0 gets order 123; code 1 gets 321; et cetera. > > data ten10; > do Id=101 to 110; > output;end; > proc print;run; > > proc format; > value orderF > 0="1,2,3" > 2="1,3.2" > 4="3,1,2" > 1="3,2,1" > 3="2,3,1" > 5="2,1,3" > ; > data �ten10 (drop=xx); > set ten10; > xx= mod( int(ranuni(28745)*10 ), 6); /* change the seed here=28745 to > get another random assignment */ > order_=put (xx, orderF.); > label order="Order of Assignment"; > proc print label;run; > > On Problem 1, I think PROC SURVEYSELCT can do it, but perhaps not. > > T!
|
Pages: 1 Prev: Location Intelligence demo Next: help with obs comparisons |