
From  "Gauri Khanna" <gwkhanna@hotmail.com> 
To  statalist@hsphsun2.harvard.edu 
Subject  Re: st: generating a matrix, adding values in a column 
Date  Sun, 21 May 2006 17:45:21 +0000 
From: n j cox <n.j.cox@durham.ac.uk>_________________________________________________________________
ReplyTo: statalist@hsphsun2.harvard.edu
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: generating a matrix, adding values in a column
Date: Sun, 21 May 2006 18:32:51 +0100
1. As with others, I can't believe that you
need this. What do you want to do with it?
However, what I think you are asking for
is just an outer product:
matrix b = J(326,1,1) * (33.12,156,227.8)
2. You can get a sum by using summarize
and looking at r(sum) afterwards.
. su area, meanonly
. di r(sum)
At some stage, it is really is more effective
to read systematically and carefully through
the manual and/or a good introductory book
on Stata...
Nick
n.j.cox@durham.ac.uk
Gauri Khanna
Dear Kit and Phil and Stata list,
I realised that i was not very clear with my question and my sincere
apologies.
I will try and be clear.
1. First of all, both of you are correct. I want to generate the following
input price matrix (not vector) with 326 rows: Input1, Input2 and Input3 are
values that I have calculated elsewhere and would like to insert these to
look like
input1 input2 input3
33.12 156 227.8
33.12 156 227.8
33.12 156 227.8
.
.
.
.
.
until the 326th row.
So I am requesting information on how to generate this matrix.
2. I would like to add the column values from 1 to n(=326). What should I
look for in help to generate this. This is what I would like to do
Plot Area
1 2
2 10
3 5.5
4 22
5 3
Generate Totalarea(a scalar?)=2+10+5.5+22+3=47.5
Again, I am sorry for my imprecise message and thank you for your responses,
they are nevertheless useful.
*
* 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–2015 StataCorp LP  Terms of use  Privacy  Contact us  What's new  Site index 