Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Generating a matrix


From   Justina.Fischer@unisg.ch
To   statalist@hsphsun2.harvard.edu
Subject   st: Generating a matrix
Date   Sat, 3 Apr 2004 21:50:05 +0200

Dear Statalisters,

I have a small problem with a macro which - as I have to admit ( is it a macro ?), has been written by a colleague a year ago ( who probably now enjoys his weekend so I cannot ask him). These lines have worked with a Stata version prior than 8.2, and as I do them now again with Stata 8.2, Stata returns an error message "invalid syntax". I tried by reading the helpfiles on matrix operations to find out what went wrong, but , unfortunately, up to now I have no clue.


These are the few lines:

forvalues i=1/26{

inequal7 S_BEHH88 if KANTON==`i'
sca gini1`i'=`r(gini)'
inequal7 S_NEHH88 if KANTON==`i'
sca gini2`i'=`r(gini)'
inequal7 S_NEHHBu88 if KANTON==`i'
sca gini3`i'=`r(gini)'
inequal7 S_NEHHKom88 if KANTON==`i'
sca gini4`i'=`r(gini)'
inequal7 S_NEHHKa88 if KANTON==`i'
sca gini5`i'=`r(gini)'
inequal7 S_NEHHSubfed88 if KANTON==`i'
sca gini6`i'=`r(gini)'

matrix gini=nullmat(gini)\gini1`i',gini2`i',gini3`i',gini4`i',gini5`i',gini6`i'}

The idea is to calculate gini-coefficients of 26 Swiss cantons (using inequal7, written for Stata7 ) and to put them into a matrix, with each column reserved for one particular income inequality. There should be then 26 rows, one for each canton. Running this program shows that Stata does calculate some inequality measures , but then stops. KANTON takes on the values between 1 and 26.

Any help would be very much appreciated.


Yours sincerely,

Justina Fischer

Dipl.Vw. Justina A.V. Fischer,
Research Associate
SIAW - University of St. Gallen
Dufourstr. 48
CH-9000 St. Gallen
Tel.:++41-71-224 2345
Fax: ++41-71-224 2298
www.siaw.unisg.ch




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