Hey all,
In advance would like to say sorry for experienced users for asking this (just cannot find the answer). I have a dataset which is Millenium cohort study (MSC6). Physical Activity (PA) is recorded for 2 days (weekday and weekend), hence two rows for each ID variable, so the question is what is the best way to handle such data? I have reshaped it to wide (it was originally in long format) and made 2 variables instead of 1. So, now I have a set of variables for day 1 and set for day 2, however there are lot of missing values and I simply cannot drop them as the whole row drops. (Picture attached). This accelerometer data: MCID - Id variable; FCACCAD - day accelerometer was assigned. Apologies if this is not really clear and any help would be highly appreciated.
[CODE]
gen day2 = 2 if (FCACCAD==2)
replace day2 = 1 if (FCACCAD ==1)
gen day1 =1 if (FCACCAD ==1)
replace day1=2 if (FCACCAD ==2)
gen MCSPID = _n
reshape wide MCSID FCACCWEEKDAY FCACC_N_VALID_HRS FCACC_MEAN_ACC_24H FCACC_MVPA_MEAN_ACC_E1MIN_100MG FCACC_MVPA_E5S_B1M80_T100_ENMO, i(MCSPID) j(FCACCAD)
clonevar fca1 = FCACCWEEKDAY1
clonevar fca2 = FCACCWEEKDAY2
clonevar valid_hrs1 = FCACC_N_VALID_HRS1
clonevar valid_hrs2 = FCACC_N_VALID_HRS2
clonevar mean1 = FCACC_MEAN_ACC_24H1
clonevar mean2 = FCACC_MEAN_ACC_24H2
clonevar mvpa_mean1 = FCACC_MVPA_MEAN_ACC_E1MIN_100MG1
clonevar mvpa_mean2 = FCACC_MVPA_MEAN_ACC_E1MIN_100MG2
clonevar mvpa801 = FCACC_MVPA_E5S_B1M80_T100_ENMO1
clonevar mvpa802 = FCACC_MVPA_E5S_B1M80_T100_ENMO2
[CODE]
Related Posts with Two ID variables for each row
Comparing each observation from one variable to few hundred thousand in anotherHi all, I am wondering if anyone has any ideas on how I can compare each observation from one varia…
Analyzing length of stay in clustered data (back transform)Hello, I'm a relatively new Stata user and am working on a project. I'm looking at length of stay (…
Calculation of directly standardized rates "distrate" or "dstdize" commandsHello, First of all I dont know if this is the proper site to publish this, correct me if its not. …
Predicted probabilities with mimrgns after xtgeeHello, This question refers to Daniel Klein's excellent mimrgns program. I am attempting to obtain …
Hep with spmap option polygonHi, Im working in a map of the metro area of Medellín, Colombia. So far good, but when I try to impo…
Subscribe to:
Post Comments (Atom)
0 Response to Two ID variables for each row
Post a Comment