Hello everyone.
I hope you can help me with a problem I am currently working on. I have a database that contains employment and university information in Ecuador. The database is in a wide format and has a unique identifier per person. The main variable is the salary in each month worked. So I have a period from 2012 to 2022, I have at least 132 salary variables (salary1, salary2, salary3, etc). Suffix 1 refers to January 2012, while suffix 132 refers to December 2022. Now I have another variable that tells me the graduation date of each person. I need to create a variable that tells me the starting salary (the first salary received after graduation). I tried this syntax, but I have cases where the person did not receive a salary on the graduation date (I have missing values). So I need it to look for the first salary after their graduation date. My graduation date variable also uses the same logic in the period, it goes from 1 to 132. Here is an example of the format of my database. I welcome any comments or help.
gen primer_sueldo = .
forval i = 1/132 {
replace primer_sueldo = sueldo`i' if tiempo >= `i' & primer_sueldo == .
}
I hope you can help me with a problem I am currently working on. I have a database that contains employment and university information in Ecuador. The database is in a wide format and has a unique identifier per person. The main variable is the salary in each month worked. So I have a period from 2012 to 2022, I have at least 132 salary variables (salary1, salary2, salary3, etc). Suffix 1 refers to January 2012, while suffix 132 refers to December 2022. Now I have another variable that tells me the graduation date of each person. I need to create a variable that tells me the starting salary (the first salary received after graduation). I tried this syntax, but I have cases where the person did not receive a salary on the graduation date (I have missing values). So I need it to look for the first salary after their graduation date. My graduation date variable also uses the same logic in the period, it goes from 1 to 132. Here is an example of the format of my database. I welcome any comments or help.
gen primer_sueldo = .
forval i = 1/132 {
replace primer_sueldo = sueldo`i' if tiempo >= `i' & primer_sueldo == .
}
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id sueldo1 sueldo2 sueldo3 sueldo4 sueldo5 fecha_grad) 1 1181 1209 1295 918 588 2 2 . . . 804 . 1 3 . 948 . . 910 3 4 630. 1099 934 1229 1181 10 5 735 887 . 1079 929 7 6 . 1204 . 682 . 10 7 924 1186 978 616 . 3 8 536 . 1028 . 1366 6 9 586 1316 568 1140 1309 3 10 . 1302 574 1150 694 1 end
Comment