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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.