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
Create preference order for source of dataHello everyone, I have occupational data for a large set of countries over time that come from diff…
try to do a loop within a loopI am a beginner stata user and new to this post. I found this forum was extremely helpful when I goo…
Hausman test for multilevel modelI want to make a Hausman test, to test wether my mixed effects model is different from a fixed effec…
Creating a table using stored values from xtsumDear all, I would like to create a table automatically using stored values. I run a command Code:…
ROC ComparisonHello All, I am trying to do a ROC Curve Comparison looking at three different models in the same d…
Subscribe to:
Post Comments (Atom)
0 Response to Sum up # of observations and output to spreadsheet/csv
Post a Comment