From: Netguy on
Dear all,
My problem is like this.
I want to simulate artificial data ranking 15 criteria (C1, .... ,
C15).
So, each observation should have any rank value between 1 and 15 to
each variable (criterion).
To do so, I have to assign an integer number between 1 and 15 to each
criterion without repetition of them.
After repeating this process, I wish to have 100 observations.

Your help will be appreciated.

Best regards,
Kilkon

From: Patrick on
Hi Kilkon

Hope the code below does what you're after:

data _null_;
length ValList $ 30;
ValList=put(1,z2.);
do i=2 to 15;
ValList=cats(ValList,put(i,z2.));
end;
call symput('ValList',cats(ValList));
run;
%put ValList=&ValList;

data want(keep=ID C1-C15);
array c {15} 8.;
do ID=1 to 100;
ValList="&ValList";
do i=1 to 15;
RemainingElements=length(ValList)/2;
PickElement=ceil(ranuni(0)*RemainingElements);
c{i}=substr(ValList,(2*PickElement -1),2);

substr(ValList,(2*PickElement -1),2)='';
ValList=compress(ValList);
end;
output;
end;
run;

proc print data=want;
var ID C1-C15;
run;


HTH
Patrick
From: Richard A. DeVenezia on
On Jul 6, 11:25 am, Netguy <kil...(a)gmail.com> wrote:
> Dear all,
> My problem is like this.
> I want to simulate artificial data ranking 15 criteria (C1, .... ,
> C15).
> So, each observation should have any rank value between 1 and 15 to
> each variable (criterion).
> To do so, I have to assign an integer number between 1 and 15 to each
> criterion without repetition of them.
> After repeating this process, I wish to have 100 observations.
>
> Your help will be appreciated.
>
> Best regards,
> Kilkon

The RANPERM call routine can be used to create artficial rankings.

----------
data foo;
retain seed 0;
do id = 1 to 100;
array c(15) (1:15);
call ranperm (seed, of c1-c15);
output;
end;
drop seed;
run;
----------

Richard A. DeVenezia
http://www.devenezia.com