Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: generating a matrix, adding values in a column

From   "Gauri Khanna" <>
Subject   Re: st: generating a matrix, adding values in a column
Date   Sun, 21 May 2006 17:45:21 +0000

Dear Nick and others,

The TRUTH.... I need to send this matrix to someone who is using GAUSS.... that is why I wanted to just generate this matrix and send it across. This matrix will then be used for simulations.

On the stata manual, i agree... unfortunately i do not have the manuals at home (only in school) and so could not look it up toute suite today being a Sunday. Anyway, I will look at them when i am in school tomorrow.



From: n j cox <>
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...


Gauri Khanna

Dear Kit and Phil and Stata list,

I realised that i was not very clear with my question and my sincere

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:
FREE pop-up blocking with the new MSN Toolbar - get it now!

* For searches and help try:

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