1

I am interested in generating a completely (damaged) randomized data where observations are selected randomly (with replacement) for each field and then combined. I will need to generate a new dummy id to represent the old id as I don't want to reconstruct the data. My goal is to create a simulated column-wise random dataset.

Here is a sample data:

Id   Col1   Col2   Col3
11   A      0.01   David
12   B      0.04   Max
13   C      0.05   Tom
14   E      0.06   West
15   C      0.02   Mike

What I am interested in is something like this:

Id2   Col1   Col2   Col3
1     E      0.04   Mike
2     C      0.06   David
3     B      0.02   West
4     A      0.04   Tom
5     C      0.05   Max

I am looking for an organized way of doing this. Here is what I attempted so far but am not interested in doing many times over since I have a lot of columns in the real data.

proc sql; 
create table newtable1 as 
     select monotonic() as id2, col1 from 
           (select col1 from Table1 order by ranuni(0));
quit;

Using the above code you generate separate random columns and then combine them using the new monotonic key.

AlxRd
  • 285
  • 1
  • 16

0 Answers0