Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: bysort, forvalues and _N


From   Constantin Alba <[email protected]>
To   [email protected]
Subject   st: bysort, forvalues and _N
Date   Fri, 25 Jan 2013 21:38:22 +0200

Dear statlist members,

I am trying to find a solution for the following problem.

I have a dataset organized by personID, for each personID there are
startDate and Duration for various activities.

I want to find out how many activities a person performs at the same
time (e.g. something like workload)

logically i see it like this:

sort personID startDate Duration

by personID: forvalues i=1/`=_N' {
                                   "compare current date with all
other prior dates+duration
                                       and update counter accordingly"
                                      }

however, by and forvalues do not work together, so i am trying to find
an alternative way to do so.


thank  you in advance

C.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index