Just a simple code that output depending on percentage.
proc sql;
select count(*) Into: OBSCOUNT
from sashelp.class;
quit;
%let pct=80 ; /* Percentage of observation to output */
data test1;
set sashelp.class ;
if _N_=INT((&pct*&obscount)/100)+1 then stop;
run;
@SuryaKiran That's not a random selection - it selects the top N records.
Yeah. @data_null__ ,John King got the point.
If you really want DELETE.
%let delete_freq=12;
proc surveyselect data=sashelp.cars group=100 out=want;
run;
data want;
set want;
if groupid le &delete_freq then delete;
drop groupid;
run;
There is a thing called Base SAS - it is the programming language your are using, even if you insist on wrapping the whole system in macro code. It is a well documented fully functional languange, and you can find all the documentation online at SAS:
proc surveyselect group=100 is randomly assigning 100 group to your data. data step is delete the data which has group <= 12.
I think you should take John King 's advice ( samplerate=0.8) , data step is totally redundant .
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.