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.
0 Response to Bysort with generation of variable
Post a Comment