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

st: question related to collapse

From   "Grigolon, Laura" <>
To   "" <>
Subject   st: question related to collapse
Date   Fri, 5 Dec 2008 00:36:18 +0100

Dear Statalister,

I have a dataset with several variables, among which a discrete variable X that looks as follows.

obs1    60
obs2    60
obs3    60
obs4    70
obs5    71
obs6    71
obs7    71
obs8    71
obs9    71
obs10   71

My final purpose is to treat adjacent observations for which the variable X does not change by more than 10% as the same observation.
In other words, I would like to collapse the dataset by X, but whenever the distance between two or more adjacent observations in X is less than 10%, I would like to collapse by a median of x. Before collapsing  I tried to generate a median of X whenever the difference within X is less than 10%, and then collapse by X, but I am not succeding. Is this the right approach? Is there a way of collapsing specifying my requirement?

Thank you in advance,


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index