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

st: small problem with 'stack' command !

From   Marwan Elkhoury <[email protected]>
To   [email protected]
Subject   st: small problem with 'stack' command !
Date   Thu, 24 Sep 2009 12:30:09 +0200

dear statalist,

I have a minor problem with the 'stack' command in stata (stata 10 for windows xp).

I have 5 groups of countries of various size length which I want to stack into a single group of two variables, say, ctryg totrnk.

right now I have cntry_i, rnk_i, for i=1 to 5
and if I write the following:

stack cntry_1 rnk_1 cntry_2 rnk_2 cntry_3 rnk_3 cntry_4 rnk_4 cntry_5 rnk_5, into(cntry_1 rnk_1) wide clear
ren cntry_1 cntryg
ren rnk_1 totrnk

It, in fact, creates two variables of size length the smallest of the size length of the groups and not stacking the entire number of observations.

what would be the easiest and smartest way of stacking this 'unbalanced' group of variables, if any, to create one group of two variables from the 5 different groups ?

best regards,

Marwan Elkhoury

*   For searches and help try:

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