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
Restricting ObservationsHi all, hoping this has an easy answer. I have different models which have different variables in th…
Adding independent variables to xtlogitDear all, For my thesis I have to research the causes of layoffs for (big) Belgian firms. Period 20…
first letters of each elementDear All, I have this data set: Code: * Example generated by -dataex-. For more info, type help dat…
Panel methods accounting for both cross-sectional dependence and endogeneity at the same time?* Are there any methods accounting for both cross-sectional dependence and endogeneity at the same ti…
Problem with the data form a multi-line Excel cellDear community, I loaded an Excel file where two columns contain more than one line (The cell inclu…
Subscribe to:
Post Comments (Atom)
0 Response to Sum up # of observations and output to spreadsheet/csv
Post a Comment