Hello,
I am trying to accumulate the number of observations for each dataset with a pattern of "consumers_YYYY_*". I was only able to "display" the number of observations. I wonder how we could "sum this up" and eventually make it as a csv for each year (i.e. two variables: one is # of observations for each year, the other is year). Thanks a lot!!
global DATA "C:\Users\90596\data"
cd "${DATA}"
foreach y of num 2004/2018 {
local files : dir "${DATA}" files "consumers_`y'*"
cd "${DATA}"
foreach file in `files' {
use ids using `file', clear
dis(_N)
}
}
Related Posts with Sum up # of observations and output to spreadsheet/csv
Using -margins- for different subsamplesHi everyone, margins, atmeans saves the means of covariates of a model in a matrix r(at), see here:…
ommited control variableHello, I have a sample of 158 firms. I control for industry, and I have 26 industry dummies. One of…
Two errors - don't understand whyCan anyone advise? Code: . use "Z:\Data\jt\survival.dta" . capture erase "Z:\Data\jt\file.dta" . …
Resolving problem with day gaps in STATAI am a new STATA user and new to this forum. I am working with daily price data of the Australian do…
missed ANOVA Matrix in OLS regressionArray Hi, it is my results for Ols regression and doesn't have ANOVA matrix but my tutor results sho…
Subscribe to:
Post Comments (Atom)
0 Response to Sum up # of observations and output to spreadsheet/csv
Post a Comment