Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: AW: dyadic dataset w string id


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: dyadic dataset w string id
Date   Thu, 25 Feb 2010 17:58:51 +0100

<> 

" I have a variable id1 that is a 4-character string specific to each
country;"



Your life may be unneccessarily harsh if you stick to string as the type for
"id1". If you

*************
destring, replace
*************

Stata checks whether any vars in your dataset can be safely turned into
numeric ones.


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Sorin Krammer
Gesendet: Donnerstag, 25. Februar 2010 17:37
An: statalist@hsphsun2.harvard.edu
Betreff: st: dyadic dataset w string id

Dear all,

I have a variable id1 that is a 4-character string specific to each country;
var1 is numeric and d1 is binary. I need to construct a dyadic dataset that
will include all dyadic combinations of this variable.


If the original dataset looks like this:
Year                        country                        id1
var1                        d1
2008                        Greece                        0214
3000                        1
2008                        Greece                        0543
6000                        0
2008                        Greece                        1234
3000                        1
Š

What I am looking for would be:
Year                        country                        id1
id2                        d1                        d2
2008                        Greece                        0214
0543                        1                        0
2008                        Greece                        0543
1234                        0                        1
2008                        Greece                        1234
0214                        1                        1

Thank you kindly for your help.
Sorin


Sorin M.S. Krammer 
Postdoctoral Fellow and Associate
MIT Sloan School of Management
50 Memorial Drive
Cambridge, Massachusetts 02142
United States
Email: skrammer@mit.edu

*
*   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/


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index