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!
|
|
0
|
|
|
|
Reply
|
Winter
|
3/30/2010 1:37:38 PM |
|
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!
|
|
0
|
|
|
|
Reply
|
tanwan
|
3/30/2010 3:33:13 PM
|
|
Doesn't good old PROC PLAN offer these tools, too?
Andrew Karp
Sierra Information Services
http://www.sierrainformation.com
On Mar 30, 8:33=EF=BF=BDam, tanwan <tanwanz...@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=3D101 to 110;
> output;end;
> proc print;run;
>
> proc format;
> value orderF
> 0=3D"1,2,3"
> 2=3D"1,3.2"
> 4=3D"3,1,2"
> 1=3D"3,2,1"
> 3=3D"2,3,1"
> 5=3D"2,1,3"
> ;
> data =EF=BF=BDten10 (drop=3Dxx);
> set ten10;
> xx=3D mod( int(ranuni(28745)*10 ), 6); /* change the seed here=3D28745 to
> get another random assignment */
> order_=3Dput (xx, orderF.);
> label order=3D"Order of Assignment";
> proc print label;run;
>
> On Problem 1, I think PROC SURVEYSELCT can do it, but perhaps not.
>
> T!
|
|
0
|
|
|
|
Reply
|
Andrew
|
3/30/2010 5:18:28 PM
|
|
|
2 Replies
356 Views
(page loaded in 0.104 seconds)
|