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
GOF of Logit Model: Pearson's chi2, Hosmer and Lemeshow's testHi everyone, I am using a logit model (attached below) to investigate the impact of minority status…
Variables created after shp2dtaHi everyone, After I run 'shp2dta' to turn shape files into Stata data files, I notice I have some …
Wide to long reshape, hundreds of stubsDear Statalist community, I fear this might be a simple question but I am having trouble finding an…
Questions about GMMHello, I'm a beginner in economitrics and statistics and I'm working on system GMM, sometimes I foun…
Seasonality in panel dataHi, I am working with panel data observations. Now, I have a question that could be sound silly. My …
Subscribe to:
Post Comments (Atom)
0 Response to one of row is non missing then replace first row of each ID
Post a Comment