
From  "Gauri Khanna" <gwkhanna@hotmail.com> 
To  statalist@hsphsun2.harvard.edu 
Subject  st: generating a matrix, adding values in a column 
Date  Sun, 21 May 2006 16:46:26 +0000 
From: Kit Baum <baum@bc.edu>_________________________________________________________________
ReplyTo: statalist@hsphsun2.harvard.edu
To: statalist@hsphsun2.harvard.edu
Subject: st: generating a vector
Date: Sat, 20 May 2006 19:30:04 0400
On May 20, 2006, at 1:07 AM, Gauri Khanna wrote:
> I would like to generate an 1 x n vector, (n=326 rows) for cross
> sectional data. This is actually an input price vector.
>
> I would then want to fill it with three or four input prices that I
> have computed elsewhere. Hence the same value for each of the
> inputs will be repeated 326 times.
I wonder whether Gauri really wants a vector in the first place. If this is crosssectional data, and the intent is to do something like multiply an existing variable times an input price, that does not require a vector: it requires a scalar or, more clumsily, a variable. If you have a variable Hours and want to generate Wage*Hours, and wage is a constant, you could just
scalar wage = 12.50
gen wagebill = wage * Hours
or, less efficiently,
gen wage = 12.50
gen wagebill = wage * Hours
Wanting to use a vector sounds a bit like working in a matrix language (e.g. MATLAB or Gauss). Although Stata contains a full featured matrix language, Mata, doing something like generating the product of factor input prices and quantities does not call for Mata; it can easily be done with Stata's scalars or variables.
Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
*
* 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–2016 StataCorp LP  Terms of use  Privacy  Contact us  What's new  Site index 