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 (September 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 24 Sep 2010 10:28:08 -0700
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: Populating Cells
Content-Type: text/plain; charset=ISO-8859-1

Michelle,

I think that the following accomplishes that which you want to do:

data have1; input Date mmddyy10. CellID Count; format Date date9.; cards; 1/5/2000 2 1 1/5/2000 4 4 1/5/2000 5 7 2/9/2000 1 4 2/9/2000 3 2 2/9/2000 6 9 1/8/2001 1 4 1/8/2001 6 6 ;

data have2; input Date mmddyy10. CellID; format Date date9.; cards; 1/5/2000 1 1/5/2000 2 1/5/2000 3 1/5/2000 4 1/5/2000 5 1/5/2000 6 2/9/2000 1 2/9/2000 2 2/9/2000 3 2/9/2000 4 2/9/2000 5 2/9/2000 6 1/8/2001 1 1/8/2001 2 1/8/2001 3 1/8/2001 4 1/8/2001 5 1/8/2001 6 ;

data final; set have1 have2; if missing(count) then count=0; run;

proc sort data=final nodupkey; by Date CellID; run;

HTH, Art ---------- On Sep 24, 12:25 pm, miimes1 <michelle.i...@gmail.com> wrote: > I have a long-term, large-scale dataset in which birds are surveyed > in > a grid pattern. This dataset contains bird counts per cell. However, > if a bird is not observed in a cell this cell is not included in the > dataset. I would like to add all cells that did not have an observed > bird into the dataset. Essentially, I want to add zeros into the > dataset. Are there any suggestions on how this could be done? I have > included the a sample dataset of the bird observation data, a sample > of what I would like the Bird Obs Data to be populated with, and an > example of what the final product should look like. Thanks ~ Michelle > > ~Bird Obs Data~ > Date CellID Count > 1/5/2000 2 1 > 1/5/2000 4 4 > 1/5/2000 5 7 > 2/9/2000 1 4 > 2/9/2000 3 2 > 2/9/2000 6 9 > 1/8/2001 1 4 > 1/8/2001 6 6 > > ~All Surveyed Cells~ > Date CellID > 1/5/2000 1 > 1/5/2000 2 > 1/5/2000 3 > 1/5/2000 4 > 1/5/2000 5 > 1/5/2000 6 > 2/9/2000 1 > 2/9/2000 2 > 2/9/2000 3 > 2/9/2000 4 > 2/9/2000 5 > 2/9/2000 6 > 1/8/2001 1 > 1/8/2001 2 > 1/8/2001 3 > 1/8/2001 4 > 1/8/2001 5 > 1/8/2001 6 > > ~Final Dataset~ > Date CellID Count > 1/5/2000 1 0 > 1/5/2000 2 1 > 1/5/2000 3 0 > 1/5/2000 4 4 > 1/5/2000 5 7 > 1/5/2000 6 0 > 2/9/2000 1 4 > 2/9/2000 2 0 > 2/9/2000 3 2 > 2/9/2000 4 0 > 2/9/2000 5 0 > 2/9/2000 6 9 > 1/8/2001 1 4 > 1/8/2001 2 0 > 1/8/2001 3 0 > 1/8/2001 4 0 > 1/8/2001 5 0 > 1/8/2001 6 6


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