Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73275

Drop variable from a sample if observation took value below 1

$
0
0
Dear Stata users,
my dataset is in panel format.

My variables are date, stock_id, adjtprcprev and cover period from 1990 to 2015. I need to drop stock_id from a sample at all if adjtprcprev took value below 1 in some stock_id/date.

Here is a sample of my data:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float date long Stock_id float adjtprcprev
19661 90069     .6
19662 90069     .6
19663 90069     .6
19666 90069     .6
19667 90069  .5699
19668 90069    .56
19768 90069    1.2
19772 90069   1.31
19773 90069   1.18
19774 90069   1.24
19775 90069   1.18
19778 90069   1.18
19779 90069   1.19
19785 90069    1.5
20264 90069   .532
20265 90069    .52
20268 90069  .5253
20269 90069    .49
16155 90071 10.655
16156 90071  10.66
16159 90071 10.925
16160 90071 10.995
16161 90071   11.1
end
format %tdNN/DD/CCYY date
Any help is much appreciated.
Thank you.

Viewing all articles
Browse latest Browse all 73275