* Created by: Jay Rotella * Date: August 24, 2003 * Purpose: * This file: * converts nest-survival data collected from periodic nest visits * from interval-specific data (1 interval per row) used in SAS * to nest-specific data (1 nest per row) used by Program MARK; proc sort data=sasuser.mall2000nd; by id int; run; data mark1; set Sasuser.mall2000nd; retain firstday; retain firstage; by id; if first. id then do; firstday= sdate; /* date at start of 1st interval = date nest was found */ firstage=sage; /* age at start of 1st interval = age of nest when found */ end; if last. id then do; lastdaylive= sdate; /* date at start of last interval for nest */ lastday=sdate + t; /* date at end of last interval for nest */ end; if firstday=. then delete; if lastday=. then delete; if lastdaylive=. then delete; /* create indicator variables for different nesting habitats */ if hab=1 then NatGr=1; else NatGr=0; /* Native Grassland */ if hab=2 or hab=3 or hab=9 then CRP=1; else CRP=0; /* CRP & similar */ if hab=7 or hab=22 then Wetl=1; else Wetl=0; /* Wetland sites */ if hab=20 then Road=1; else Road=0; /* Roadside sites */ drop sdate sage; run; data mark2; set mark1; array age{90}; /* where 90 is the number of days in the nesting season */ do i=1 to 90; if i35 then age{i}=0; end; run; data markinp; set mark2; /* Create a text file with the necessary output for MARK */ /* The directory used in the statement below must exist on the computer being used */ file 'C:\Documents and Settings\Rotella\My Documents\research projects\nest success ducks\MallMARK.inp' ; /* Use the ID number for the first nest in the data set to put header line on file for MARK */ /* the next line can be deleted id ID numbers aren't in the dataset. But the header line */ /* for MARK must then be put in by hand before using it in MARK. */ if id=1 then put "Nest Survival Group=1 ;" ; /* The code below is appropriate when a fate of 1 is used for a nest that survives an interval and */ /* a fate of 0 is used for nests that fail during an interval between 2 visits. */ /* The list of variables to be included can be adjusted according to models of interest */ if ifate = 1 then put "/* " id " */ " firstday lastday lastday " 0 1 " age1-age89 robel pctgr4 NatGr CRP Wetl Road";"; else put "/* " id " */ " firstday lastdaylive lastday " 1 1 " age1-age89 robel pctgr4 NatGr CRP Wetl Road";"; run;