Hello everyone,
It' s my first post here and I am at beginner level, maybe my question is easy for everyone but I haven't found any solution yet.
I have a dataset that contains observation about number of kids in a household in different years. The data contains 19 columns and 4524 observations for each column.
here is an example:
idpers ownkid99 ownkid00 ownkid01
4101 3 3 3
4102 3 3 3
5104 . . .
13102 2 2 2
27101 3 3 3
28101 2 2 2
35101 2 2 .
42101 2 2 2
45101 1 1 1
45102 1 1 1
49102 2 2 2
(dots are missing values)
What i want to do is to create a matrix, filled with 0 that is equal to my dataset.
To do this I have created the matrix using command:
matrix A = J(4524,18,0)
and then convert my dataset in a matrix:
mkmat ownkid99 ownkid00 ownkid01 ownkid02 ownkid03 ownkid04 ownkid05 ownkid06 ownkid07 ownkid08 ownkid09 ownkid10
> ownkid11 ownkid12 ownkid13 ownkid14 ownkid15 ownkid16, matrix(AD)
Now I have two matrix and i want to generate a new matrix that take two values, 1 if there is a difference between ownkid99 and ownkid00, 0 otherwise. The goal is is to capture difference for each year.
I apologize if the question is not clear, thank you in advance.
Related Posts with Difference between two matrix
Generate dates that correspond to the 1st Tuesday of each monthHi, The Australian RBA meets the first Tuesday of each month 11 times a year (every months but Janu…
Comparing regression coefficients across groups in presence of fixed effects with suestHi all, I am trying to run regressions with a building by month panel. Each building have a unique b…
Fixed effects stability test or Joint F test for fixed effectsHello every one, I have the wage gap between immigrants and natives Born by census metropolitan are…
Excel's XIRR function in StataHi Forum I am attempting to perform financial investment performance analysis. For small test samp…
How to Aggregate Repeating Dates into new tableI can't remember how to effectively reshape repeating dates in a time series into a new table. Belo…
Subscribe to:
Post Comments (Atom)
0 Response to Difference between two matrix
Post a Comment