LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 18 Apr 2000 14:25:44 -0400
Reply-To:   "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject:   Re: Dividing Dataset Into Two
Comments:   To: O J Nwoha <nwohaj@SPECTRE.AG.UIUC.EDU>
Content-Type:   text/plain; charset="iso-8859-1"

> 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


Back to: Top of message | Previous page | Main SAS-L page