I'm using the Collapse command in Stata to aggregate a series of numbers by different categories. The data is a series of individual hourly regression estimates (hr1-h24) as well as a few other variables. The objective is to create a mean value for each hour, multiply by a population count, and then sum to different category levels. The code looks like this: collapse (mean) p10_hr1-p10_hr24, by(date cat1 subcat2 subcat3)
joinby date cat1 subcat2 subcat3 using popcnt.dta
reshape long p10_hr popcnt, i(date cat1 subcat2 subcat3) j(hour)
replace p10_hr = p10_hr * population
reshape wide p10_hr, i(date cat1 subcat2 subcat3) j(hour)
collapse (sum) p10_hr1-p10_hr24, by(date cat1 subcat2 subcat3)
It's at this point that I get an error message:
error:
p10_hr1 = (mean) p10_hr1
p10_hr1 = (sum) p10_hr1
name conflict
r(198);
Does anyone know what is going on here?
I've also posted this question on Reddit:
https://www.reddit.com/r/stata/comme...20Amazon%20SES
Related Posts with Collapse command error message that has me stumped
Newey-West standard errors with multiple regressions (by Identifier)Dear all, I am currently writing my thesis for which I need some help. I have a panel-data data set…
Mininum edge weights in the path between two nodes (Network Analsysis)Dear Statalisters, (Stata version 15.1) I have a network N and I am using the user-developed packag…
Fixed effect model predictionHello all, I hope everyone's doing well. Using my dataset I have found the fixed effect model to ha…
fmm invalid nameI'm trying to run a finite mixture model Code: fmm 2: logit y x1 x2 x3 However, I get the error "2 …
Logistic regression when all variables are proportions (percentages)Both my outcome variable and my independent variables are proportions (%). I am trying to run a logi…
Subscribe to:
Post Comments (Atom)
0 Response to Collapse command error message that has me stumped
Post a Comment