What I have in mind is pretty straightforward in principle. Many ados
have a few lines at the top that start with the characters "*!". I would
want to grab the line that has "*!" followed by "version". E.g., ivreg
has at the top
*! version 5.1.3 21jul2004

Ok, I thought you were referring to the Stata Version command. It
seems like an additional complication is that authors aren't required
to format their programs this way. Just as a matter of curiosity,
how much would you need to do this? This strikes me as the sort of
thing that might be easier to do by hand, or to maintain in some sort
of database, depending on what exactly it is you need.