Hello everyone. Thanks for looking at my post. I hope you can help a PhD candidate...
I have a data set with 170 subjects, each of whom have daily repeated measures for up to 7 days, in addition to many one-time measures like demographics, baseline characteristics, and outcomes. My data is in long form and each subject has a different number of rows. In long shape it is 1800 rows and there are about 100 columns. I need to convert the whole thing to wide format to work on a mixed effects logistic regression model. I didn't have a good "j" variable for the "reshape wide" command. I tried creating one which I called j1 with [by record_id: generate j1 = _n] which appears to give me a unique variable within each subject, but when I tried [reshape wide age race ethnicity ... [ 100 variables], i(record_id) j(j1)]. I got the command to run and my data is reshaped to (really)wide, but those measures which should only occur once (e.g., age, BMI, mortality) now are duplicated 19 times (i.e., age1, age2, ..., age19). when I tried to reshape with only the daily repeating measures, the command won't run and I get "variable variablename not constant within record_id." I could go through air drop almost 2,000 useless variables, but is there a more eloquent way?
I'm using Stata/IC 14.2 running in a Microsoft remote desktop on a mac. I hope this post was both precise enough and concise enough.
Thank You,
Tom Lawson
Related Posts with converting long to wide - creating a j variable
Repeated Measures ANOVA test without Greenhouse Geisser and Huynh-Feldt P-valuesArray Array Good Afternoon, I am hoping someone is able to help. I'll try and be as concise as possi…
How to identify same child in two rounds of Survey Data?Hi, I working with a panel data comprising of two rounds- 2005 and 2012. I want to keep the same ch…
Display multiple ROC curves in one graph using roctabHi everyone, I am performing multiple empirical ROC analysis stratified for sex. I would like to di…
Extract and store 95%CI after ttestDear statalisters, I would like to know how to extract 95%CI for "diff" (difference in means parame…
Asking about Interpretation for the sign and significance of rho variables derived endogenous switching regression modelDear everyone, I am currently working the impact of integrated aquaculture and agriculture farming …
Subscribe to:
Post Comments (Atom)
0 Response to converting long to wide - creating a j variable
Post a Comment