|
> From: O J Nwoha [mailto:nwohaj@SPECTRE.AG.UIUC.EDU]
> I have a dataset of 13608 observations and I want to break it into two
> datasets as follows:
>
> Dataset A has 80 percent of the observations.
> Dataset B has 20 percent of the observations, but I need it to contain
> every fifth observation from the entire data set. Observations in A
> should not be in B.
use the mod function with _N_
mod(_N_,5) will return 0..4
data _80 _20;
set old;
if mod(_N_,5) = 0 then output _20;
else output _80;
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
---> cheerful provider of UNTESTED SAS code!*! <---
e-mail your SAS improvements to: suggest@sas.com
archives: http://www.listserv.uga.edu/archives/sas-l.html
|