Hi,
I have the following file
Year id X Y
986 6215 1 .645
1986 1781 1 .778
1986 2774 1 .819
.....................
1986 817 10212 .962593
The actual file has about 250 observations.
I have created 25 gps based on quintiles of X and Y as follows
year Id X Y X-Quntile Y-Quntile Group
1986 817 10212 .962593 1 3 13
1986 2675 4930 .7089249 1 1 11
1986 753 4617 .7927225 1 2 12
1986 433 3271 .9935799 1 3 13
1986 2227 3076 .6346879 1 1 11
1986 3701 2497 1.189828 1 4 14
Now I append another observation to the dataset
Say
Year id X Y
1986 230 62 .95
How can I allocate this to the appropriate group?
Note, I cannot include the new case in the first instance that I form the
groups.
My approach is to calculate the maximum and minimum values of X and Y for
each variable
The compare X to the maximum and minimum values for various groups and get
the Quntile number(s) for X (But the problem is there may be more than 1
group where it matches), then for each of those quintile numbers I need to
see the quintile number for Y. Then get the final grouping.
It seems like a nested loop but I cannot figure out how to code it..
Any help is valuable
rajesh
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/