# st: Generating Data Structure To Estimate Multinomial Logit via Programming

 From "Stata User" To statalist@hsphsun2.harvard.edu Subject st: Generating Data Structure To Estimate Multinomial Logit via Programming Date Thu, 27 Oct 2005 08:38:57 +0200

Dear Stata Users,
I have observations of 4 holiday passengers choosing between going on holiday
in 3 different countries: Germany, France and Spain. So country is the categorical
choice variable. This categorical choice variable has 2 attributes: temperature and
humidity. This is how the data structure looks like now (simplified example) :

Table 1:Data Structure Now

| Choice (country) | Temperature | Humidity | | | | |
| | | |
Passenger 1 | Germany | 24 | 45 |
Passenger 2 | France | 26 | 55 |
Passenger 3 | France | 26 | 55 |
Passenger 4 | Spain | 29 | 65 |

Now I want to replace the categorical choice variable 'country' with a dichotomous
choice variable. This means when a passenger chooses Germany and he does not
choose France and Germany, we observe three decisons of the passenger which
will be coded with '1' for Germany and '0' for France and Spain. So this below in
Table 2 is the data structure I desire. Since I have too much data, I have to find a
programming solution in order to transform Table 1 into Table 2.

Table 2: Desired Data Structure via Programming

| Dichotomous | Categorical choice | Temperature | Humidity |
| choice variable | variable | | |
| | | | |
Observation 1 | 1 | Germany | 24 | 45 |
Observation 2 | 0 | France | 26 | 55 |
Observation 3 | 0 | Spain | 29 | 65 |
Observation 4 | 0 | Germany | 24 | 45 |
Observation 5 | 1 | France | 26 | 55 |
Observation 6 | 0 | Spain | 29 | 65 |
Observation 7 | 0 | Germany | 24 | 45 |
Observation 8 | 1 | France | 26 | 55 |
Observation 9 | 0 | Spain | 29 | 65 |
Observation 10| 0 | Germany | 24 | 45 |
Observation 11| 0 | France | 26 | 55 |
Observation 12| 1 | Spain | 29 | 65 |

Stata User 2005 from Europe

_________________________________________________________________
Die neue MSN Suche Toolbar mit Windows-Desktopsuche. Suchen Sie gleichzeitig im Web, Ihren E-Mails und auf Ihrem PC! Jetzt neu! http://desktop.msn.de/ Jetzt gratis downloaden!

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