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.