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]

Re: st: Need help with -collapse- or a better solution


From   Tim Wade <[email protected]>
To   [email protected]
Subject   Re: st: Need help with -collapse- or a better solution
Date   Sat, 1 May 2010 09:57:10 -0400

Not sure this is exactly what yo uare looking for but maybe something like:

input id year score
1 1 10
1 2 10
1 3 10
1 4 11
1 5 11
1 6 20
2 1 5
2 2 6
2 3 7
2 4 7

 qui bysort id (year): gen diff=score-score[_n-1]

then you can keep observations with no change (diff=0)

Tim

On Fri, Apr 30, 2010 at 11:36 PM, Reifschneider Harry III
<[email protected]> wrote:
> Statalisters,
>
> Stata/IC 10.1 for Macintosh
> Born 01 Oct 2009
>
> I need help with -collapse-. I am a grad student and thus just learning this
> software (and this is my first post), so please be gentle!
>
> I have 8 years of data which are broken out into 1 year snapshots, so 8
> observations max for each person. I need to find a "change" in a test score
> (afqtscore for this example, but there are 5 total). Not all the
> observations have a change and thus I am only concerned with those that do
> change. The -help collapse- command talks about percentiles, means, etc.,
> but I need the actual change, e.g. years 1-4 score is 50 and in year 5 the
> score changed to 60 and then remains that way for the duration of the
> sample. I am looking at the probability of an increase/decrease in the score
> and the magnitude of change and need to know if there is a change and also
> the amount. Further more, I am only interested in the demographics (gender,
> age,marital status, etc.) at the time of the "updated" or newer score. Same
> thing goes for "civilianeduclevelcode1" . Can someone show me an example of
> the code to write to get at this requirement? If my description of the
> problem is lacking, I am sorry and can try better. Thanks and have a great
> weekend!
>
> seqnumber is the "snapshot" of the fiscal year
>
> uniqID          afqtscore       seqnumber       primarymos
>  maritalstatuscode       civilianeduclevelcode1
> A17082          42                      199                     9900
>    S                                       12
> A17082          42                      211                     341
>             M                                       12
> A17082          48                      223                     341
>             M                                       12
> A17082          48                      235                     341
>             M                                       12
> A17082          79                      247                     341
>             M                                       14
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

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


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