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
Moving average invalid syntaxHi all, I'm creating my own moving average code since I only want the top four of the previous seve…
Issue with converting date in dd.mm.yy format to dd/mm/yyyyI have a historical dataset with teenagers' birthday in the format of dd.mm.yy, while they were all …
Importing descriptive tables with outreg2Hello, I´m trying to export the results of this descriptive table to word using the command outreg2 …
SEM builder with Random InterceptsHello everyone! I am trying to build a model with random intercepts with the SEM builder. In my data…
Identifying and flagging matchesI have a large dataset with rows that include a unique identifier 'id' and a unique time variable ca…
Subscribe to:
Post Comments (Atom)
0 Response to one of row is non missing then replace first row of each ID
Post a Comment