Hi
I have a dataset with 10 variables and 600k records. It is the end result of a number of preceding processes, and one of the effects of these processes is that the dataset is ordered by age. Is there a simple sas procedure which can be written to get rid of the sorting ? I don't want to do say 3 proc surveyselects and then put the datasets together again
This will order your data randomly:
data want;
set have;
scramble_var = ranuni(0);
run;
proc sort data = want;
by scramble_var;
run;
This will order your data randomly:
data want;
set have;
scramble_var = ranuni(0);
run;
proc sort data = want;
by scramble_var;
run;
Great thanks SASKiwi !
Hi,
Just for laughs, try proc whisk?
For the above, you could do in one step:
proc sql;
create table want as select * from sashelp.cars order by ranuni(0);
quit;
Also, I would ask why do you want to scramble the dataset. Generally ordered datasets would be easier to use, maybe you just need to change the order or retain original ordering:
data original;
set original;
ord=_n_;
run;
Then later on sort by _n_ to get it to the original sort.
Also great thanks RW 9 ! I want to scramble the datasets so that the customers are not called in any predefined sequence or bias which is built in via the preceding datasteps
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.