If the issue is which of a set of names is in another list,
then this is very inefficient, although you might be hard put
to notice that.
-ds- is an undocumented command written in Stata,
but as such implies an interpretative overhead which
is not needed here.
The -help- for -macrolists- gives details of various
list operators that should offer more direct solutions,
including intersection, union and difference.
Nick
[email protected]
Ada Ma
> Oooops - don't mind me, I think I have just figured out a solution
> after reading
> David Elliott's email. I can put all the variables' names in a
> global, loop through the global list and -ds- each variable on the
> list, and if the return code is 0 then I add it to a final list, where
> I'll then use it to draw varibles out from the datasets.
>
> However if you have some good suggestions please fireaway
> anyway! Cheers!!
On 11/4/06, Ada Ma <[email protected]> wrote:
> > I want to draw out a set of variables from the QLFS from all 1992 to
> > 2005. I can do a loop to loop through all the years and quarters,
> > however, getting the variables out is a bit tricky.
> >
> > Most of the variables keep the same name throughout the 14
> years, but
> > there are a good number where they had changed names, only appear in
> > Spring and Autumn and not others, only introduced some
> years after the
> > series started, etc. For example gross pay is called GROSS99 from
> > 1999, but EMPGRO in years prior to that. A Cohabitating dummy was
> > introduced in 2000. Then new Standardised Occupational
> Classification
> > code was introduced in 2001. These are just three out of
> many changes
> > that had been introduced to the data set through years.
> >
> > Is there anyway to get around this so that I may pull out all the
> > variables I would like to get, if they're available, without having
> > set up an unique varlist for each and every one of the datasets?
> > There are 57 quarters and quite a good number of variables
> I'd like to
> > pull out. The alternative would be to append all 57
> quarters and then
> > pull out the vars, but the datasets are rather big so it's not an
> > option that is open to me given the computers I have access to.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/