Statalist


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

st: stata question?


From   Arina Viseth <[email protected]>
To   [email protected]
Subject   st: stata question?
Date   Sun, 15 Feb 2009 16:19:05 -0500 (EST)

Dear Statalist, 

Thank you very much for all of your suggestions on my encode question, I really appreciated your kind help - my variables have been back into numerical thanks to you. 

I have another question and I was hoping you could help me on that too: I would like to stack some variables in my dataset but at the same time keep the rest of my variables - I am trying to code a loop for that but I can't seem to get it right. 

I.e., currently, my dataset currently looks like the following (I have about 100 indices for 15 years and 200 countries): 

Indice    Year   CountryA     CountryB   CountryC 
1         1995    .2          .a         .1 
1         1996    .36        .12        .45 
2         1997    .15        .26        .45 
2         1999    .22        .33        .11 
3         1995    .a          .22        .33 

My question is how could I stack my country variables under one column named "Country"  by indice and year, and also have another column that would contain my values? 

so I would have the following: 

Indice Year  Country    Values 
1      1995  countryA      .2 
'      1995  countryB      .a       
'        '   countryC      .1 
'      1996  countryA 
'            countryB 
            countryC 
2      1997  countryA      .15 
'      1997  countryB      .26 
' 
3      1995  countryA      .a 
      1995  countryB      .22 
      1995  countryC      .33 

Thank you very much in advance for any suggestion, I would immensely appreciate your help again. 

Arina 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index