Dear Listers,
Each ID has long rows for the ID and an indicator - complete_surgical. I want to change the indicator to 1 in row 1 and row 51 if first three rows of each ID has non missing in procd1_7. So complete_surgical in row 51 should be 1 as procd1_7 in row 51, 52 and 53 has at least one non missing value. Of course this is part of the whole data and there are so many personids.
clear
input float complete_surgical byte(procd1_7 procd8_36w) str12 subjid str21 personid
1 0 0 "N01REACT1001" "1"
1 0 0 "" "1"
1 1 0 "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
. . . "" "1"
1 . 0 "N01REACT1002" "2"
1 . 0 "" "2"
1 1 1 "" "2"
. . . "" "2"
. . . "" "2"
. . . "" "2"
. . . "" "2"
. . . "" "2"
end
Many thanks in advance.
Kind regards,
Kim
Related Posts with one of row is non missing then replace first row of each ID
Creating a new set with every possible pair within a groupDear all, I would like to create a new dataset that includes all possible pairs of observations, wi…
Need help with creating certain variablesHi. EmpCode OfficeCode Year Sept_30 In Out Existing 1 11 2011-12 . . 1 12 2011-12 1 . 1 . …
Panel cointegration with I(0) and I(1) variablesHi all! I need to run a cointegration test with the indipendent variables of the model I(1) and the…
R-squared of FE-regressionDear, with the following data: Code: * Example generated by -dataex-. To install: ssc install data…
Manipulating local listsIn my code below I expected to get a local macro (myvars2) with a list of all my variables (which ar…
Subscribe to:
Post Comments (Atom)
0 Response to one of row is non missing then replace first row of each ID
Post a Comment