Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65055

looping over data files to generate percentage changes

$
0
0
I need to loop over 10 different data files (dataset 1-10) and generate percentage changes based on a categorization generated in dataset 1.

More specifically, I need to divide a list of around 1000 occupations by weekly wages in dataset 1 by top 1/3 earning, middle 2/3 earning, and bottom 3/3 earnings, record these occupation categories (i.e., bottom third=occupation 987, 566, 890...) and then look at percentage changes in the number of jobs for these three groups over 9 other datasets.

Normally, I would do this using excel and Stata together; however, in this case, I need to generate the Stata code to give to someone else to run.

Obviously, I would create a loop to work over the different files:

. foreach file in "file1" "file2" ... { . use `file', clear However, how do I create a categorization in dataset 1 that carries over to the other datasets? Thanks for any assistance people on this forum can provide. Ashley P. University of British Columbia

Viewing all articles
Browse latest Browse all 65055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>