I have 2 datasets: A.dta, and B.dta. I want the same set of codes to run on A & B depending on the dataset that I choose.

In C++, for example, I could write:

Code:
cout<<"Which dataset do you want to use?"
cin>>dataset
if (dataset == A)
{
           //code
}
if (dataset == B)
{
          //code
}
Is there a similar thing that I can do with Stata?

P.S. Asking me to write down 'what I wrote in Stata and what is not working for clarification' would be a non-sequitur because I couldn't find anything which works in such an interactive way in Stata. All I could do is write an analogous C++ code.