If I have a table, how can I get the top 50% of records into one table and thereafter the bottom 50% of records in another table?
I generally use PROC SQL;
data _NULL_; if 0 then set sashelp.snacks nobs=count; call symputx('numobsDIV2' ,put(int(count/2),8. )); call symputx('numobsDIV2_plus1',put(int(count/2)+1,8.)); STOP; run; %PUT &=numobsDIV2; %PUT &=numobsDIV2_plus1; PROC SQL noprint; create table work.First_50_pct as select * from sashelp.snacks(firstobs=1 obs=&numobsDIV2.); create table work.Last_50_pct as select * from sashelp.snacks(firstobs=&numobsDIV2_plus1. obs=MAX); QUIT; /* end of program */
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.