mercredi 21 juin 2017

Program in Stata that differentiates file type (datasets and do-files)

I am trying to write a simple program in Stata where my students can download datasets and example do files from my website. This program is called "usecda" and below is the example where it only opens datasets.

capture     program drop usecda
program     define usecda
args        data 
use         http://ift.tt/2tOx5lX', clear
end

Then I can do:

usecda hrs_subset.dta

I would like the same program to run do-files. How I differentiate the do-files from dataset file in the program (using an if-statement I assume)? I am open to either differentiate them by file type (.dta or .do) or by using a term in the name file (the do-files all have "lecture" in them).

This program would be able to do the usecda hrs_subset.dta to open the dataset and also usecda cda_lecture_nominal.do to run the do file

Thanks for your help!

Aucun commentaire:

Enregistrer un commentaire