I am trying to calculate the daily mean of a variable contingent on various conditions. For example, if I have temperatures taken throughout the day at multiple locations, how can I get the daily temperature recorded at each location.
The main variables are date, temperature and some booleans for location such as isJFK, isCP etc.
For the entire data set, you can do
bysort date: egen dailymean = mean(temperature)
How can I get the daily temperature for one location
bysort date isJFK: egen dailycpmean = mean(temperature) does produces a new column of results but they don't seem to be daily temperature for JFK.
Related Posts with Bysort with generation of variable
Ommited because of collinearity even though 'collin' and 'vif' commands show no correlation.Dear all, I have a challenge that I cannot understand or deal with. When I run my regression I get a…
Very large t-statisticsDear all, I am performing cluster robust WLS and fixed effects models on a relatively small dataset…
No observation error in areg using variables within a rangeHello there, have created three variables represing three classes (discrete) of travel times, naley…
Reshape command with quarterly dataI would like to reshape my data from wide to long format. My headers are dates every quarter so 31-1…
overlapping labels on the same pointHi all, I saw many related problems to the following but, as far as I have understood, such issues …
Subscribe to:
Post Comments (Atom)
0 Response to Bysort with generation of variable
Post a Comment