flexmat : addcol


addcol is a sub-command of flexmat program. It adds a column to a flexmat matrix. This sub-command has three required options :

1. data(data1, data2, data3, …)

2. row(int),

3. col(int).

The data items in the option data() should be separated by a comma or any other parsing characters such as pipe (|), semi-colon (;), etc.  If the parse character is not comma, then option parse(str) has to be used to specify the parsing character.

Let us continue writing to the same matrix that we started in the previous example example. This time, instead of writing rows, we shall add a complete column to the existing matrix.
Our column will start from column number 4 and row number 1. We shall use the default parsing, i.e. comma.

* Code line 10
flexmat addcol, data(Min, 0, .012, 0.025) r(1) c(4)

  0 |1              2       3         4 
----+-----------------------------------------
  1 |Year        Mean      SD       Min 
----+-----------------------------------------
  2 |2001        5.1%    1.5%         0 
  3 |2002         6.7     1.6      .012 
  4 |2003        6.58    1.61     0.025 
----------------------------------------------

Explanation

In code line 10, we used the sub-command addcol. We passed on three cells of data, each cell separated by the default parsing character, that is comma. We wanted to add this data to row number 1 of the existing table, therefore, we used the option r(1) which we could have also written as row(3). We wanted the addition of the cells to start at column 4, so we wrote c(4). Since default value for both row() and col() are 1, we could have skipped the r(1) altogether. However, it is a good practice to write it so that it is more readable to readers of the code.

In the following code, we add one more column at column location 5.

* Code line 11
flexmat addcol, data(Max, 0, .012, 0.025) r(1) c(5)

  0 |1            2      3        4        5 
----+-----------------------------------------------
  1 |Year      Mean     SD      Min      Max 
----+-----------------------------------------------
  2 |2001      5.1%   1.5%        0        0 
  3 |2002       6.7    1.6     .012     .012 
  4 |2003      6.58   1.61    0.025    0.025 
----------------------------------------------------

Previous : sub-command addrow        Next : Write the matrix to Word file with asdocx