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 .
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.