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

cleaning do file to run over multiple datasets

$
0
0
Hi -

Another data management question:

I have 7 country datasets. I want to be able to run one cleaning do file that cleans all 7 datasets with a loop.

It needs to:
1. import the baseline survey data .csv
2. save the baseline survey data .dta
3. import the endline survey data .csv
3. save the endline survey data .dta
4. merge 1:1 baseline and endline
5. save the merged baseline and endline data as one dataset
6. clean the data (various commands and steps)
7. save the cleaned data .dta

I have all of the code written to do this country by country, but I want to be able to do it in a loop. All of the datasets are saved in gl macros.

It is possible to create a loop that does those 7 steps, right? If so, any recommendations on where to start/find example code for that? Happy to try to explain again if that doesn't make sense.

Thanks!

Viewing all articles
Browse latest Browse all 72768

Trending Articles



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