[Babase] male dispersal query

Niki Learn nlearn at princeton.edu
Thu May 20 16:01:00 EDT 2010


On 05/14/2010 02:53:27 PM, Niki Learn wrote:
> Aside:  Speaking of which, while looking at the interp column in
> members I
> discovered that AMO is weird.  Everyone else has no more than one 
> date
> where
> interp = 0 (but not everyone has a 0 point at all...what does that
> mean?  I
> thought they each got one at birth?) but AMO has interp = 0 for every
> census
> date we added to fill in his time when he was known as Billy...  It
> seems
> like something went wrong there?  [Btw, I added BIL to
> snames_not_in_biog.]

It means that MEMBERS was broken and that I should not fall behind
on my email!  :-)

Niki:  Yeah, I figured that out!
 
> Main point:  I have encountered a similar problem (to the male
> dispersal
> query problem) when dealing with female sexual cycle data.  We
> recently
> wanted to know about the time period spent lactating and then cycling
> after
> each birth.  But each pid is linked to the cycle PRIOR to birth, not
> the one
> after it.  I could not find a way to get babase to link to the cycle
> for the
> next pid (which is tricky anyway since a few females have pids that
> are out
> of order or where one is skipped) and ended up having to run separate
> queries, then line them up in Excel and calculate the cycling time
> after
> sorting by pid.

Does PREGS.Resume not do the trick?

Niki:  That's how I got one of the pieces.  I couldn't get babase to output
them altogether though.  I don't recall the details of all the things I
tried at this time.  Maybe if I uploaded one output or another and then did
more joins onto that it would work (that's what I did for some male rank
queries I also did recently).  That's at least as annoying as lining them up
by pid in Excel though.  

>  Maybe it joining in parity from the pregs table
> should work
> but parity doesn't show up anywhere else so that is yet another level
> of
> complexity and I couldn't get it to work.
> 
> Anyway, it seems like it would be helpful to be able to pull data out
> by the
> start and end of each event (whether it be changing groups or
> transitioning
> to another reproductive phase, etc.) and to be able to link one event
> to the
> next one chronologically.  What's the best way to go about that?  Is
> making
> views the only way to do it?  I had thought maybe I could identify 
> the
> end
> of an event and then add a day to the date to get the start of the
> next
> event but could not figure out how to do get babase to add a day to a
> previously identified date.  

I don't know that there's a general answer to this question.  A view
is just a query that you don't have to re-write every time you
use it.  How the view/query works depends on the data in question.

Niki:  Maybe I need to know more SQL tricks?  There aren't very many listed
in our "SQL for babase" page, I'll tell ya that.  I have gathered others off
the internet from time to time as needed but I don't always know what can be
done to look for.





More information about the Babase mailing list