Hi,
It is a simple way to get random 100 row from your dataset.
HHCFX
proc sql outobs=100;
create table WANT as select * from HAVE order by ranuni(0);quit;
proc sql outobs=100; create table random as select * from a order by ranuni(0);quit;
proc sql outobs=100; create table random as select * from a order by ranuni(0);quit;
Specifically, this selects 100 rows WITHOUT REPLACEMENT. That is, the rows are unique. In some applications, you might need other sampling schemes, such as selection WITH replacement. The SURVEYSELECT procedure is a general way to select rows from a data set. It supports many different sampling schemes: with replacement, without replacement, stratified sampling, and more.
See this article for a discussion and an example of ways to sample with replacement in SAS.
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.