Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Hi Thank you all for your answers.

    I have two further question.

    Let's assume I have 4 datasets, two with a filename starting with "ABC..." and the other two with a filename starting with "DEF...", saved in two different folders: ABC and DEF respectively. Both folders are saved in the main folder, namely "Datasets".
    How can I use the command previously seen to say to Stata: "Use all the files in the folder Datasets and its sub-folders ABC and DEF, make the desired operations, and save them in the original folder, with a "_v2.dta" name"?.

    Then, let's assume that I want to do some operations on all datasets (both "ABC..." and "DEF...") and one operation only on "ABC..." datasets.
    How can I say to Stata: "Only for datasets whose name starts with ABC, do also this specific operation"?

    Thank you again!!

    Comment


    • #17
      It is the same answer. In several posts we and you too were using wildcards like *.dta *.txt. You just need more restricted wildcards such as ABC*.dta

      There is a delicate trade-off here, but you don't have to imagine generalising to produce more and more general code to take different file specifications, different directories whatever.

      Sometimes it is as or more efficient to take a chunk of code and just rerun it with one detail changed, or in a different place.

      I was writing do-files only for an awful long time before I decided to get to grips with Stata programming strict sense, despite a background of programming in various languages.

      Comment

      Working...
      X