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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.