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 cross-sectional 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.