Hi I have other two questions for you all. I have a number of datasets (about 250) and I want to create an unique .do file in which storing a series of commands that can be run in all the datasets. Now, the first question is how can I say to Stata: "For all datasets in this folder, do the following commands"? - probably, I need to use a loop... Then, since I don't have exactly the same variables in all the datasets (the 90% of them are the same, but there are some variables missing or some variables more in each dataset), my second question is how to say to Stata: "Check if this group of variables exists. In the case it exists, do the following commands"?

For example, let's suppose that I'm interested in three groups of variables: demographics (all these variables start with d*), income (all these variables start with y*) and assets (all these variables start with a*), but the group "assets" is not present in all the datasets. How can I say to Stata: "Check if variable group "assets" exists, and if it exists then do a certain command" (for example, replace all value with 0 if age is <18)?

Thank you!!