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
How to merge two datasets and How to use keepHello everyone! I'm a very beginner using STATA so please I'd like to get some help with merge comm…
Counting unique idsWhen I use the following code: Code: bys month: count(refer_id) Is there anything I can add to it …
Pooling Data in Longitudinal/Cross-Sectional SurveyHello everyone; I am working with the National Longitudinal Survey of Children and Youth (NLSCY); a…
multilevel model with dependent ordinal value(Likert scale) and longitudinal dataHello everyone, i am handling the data with Likert scale(Survey data) and i have to use multilevel …
Graphing averages using collapse mean and loops with same suffixHello, I am trying to graph cross-country distributions along with international averages using loo…
Subscribe to:
Post Comments (Atom)
0 Response to Bysort with generation of variable
Post a Comment