Hello All,
I am trying to import d.ta file and append them, what is wrong with this code? For some reason it only uses the first file from 1995, but does not continue with the subsequent years. Thanks in advance
clear all
cd "mydir"
save file_all_green, replace emptyok
forvalues i= 1995(1)2018 {
use country_partner_hsproduct6digit_year_`i',clear
keep year export_value location_code partner_code hs_product_code
append using "file_all_green"
save file_all_green,replace
}
Related Posts with Loop and Append .dta files
Mediation analysis using path models with continuous mediator and binary outcomeDear Statalisters, I am performing a mediation analysis using path models (using sem or gsem) where…
Randomly generating an ID which is same for duplicates of an observationThere are 4 states coded 1,2,3 and 4. Within each state, I have generated a unique id to identify mo…
String variable quarterly timeHello everyone, First of all, I have learned a lot from this forum. However, I could not find the a…
Calling a program whose name is a localHi all, My question is quite straightforward I guess but I did not find any answer on the web. Let…
Cohort variableHello! I am using data about households and I am interested in analyzing homeownership and mortgage …
Subscribe to:
Post Comments (Atom)
0 Response to Loop and Append .dta files
Post a Comment