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

st: Re: Generating a matrix


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Generating a matrix
Date   Sat, 3 Apr 2004 14:57:57 -0500

The only thing that looks like it might cause a syntax problem is the
closing brace of the forvalues loop being on the same line as the matrix
command.  Try putting it on it's own line and see if that helps...

Michael Blasnik
michael.blasnik@verizon.net


----- Original Message ----- 
From: <Justina.Fischer@unisg.ch>
To: <statalist@hsphsun2.harvard.edu>
Sent: Saturday, April 03, 2004 2:50 PM
Subject: st: Generating a matrix

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


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



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