Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: catching variable mismatch in the data


From   Paul Byatta <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: catching variable mismatch in the data
Date   Fri, 13 Sep 2013 03:35:38 -0700 (PDT)

Hi Statalist

I writing lines of commands that will alert me whenever there is a mismatch between variable names. I know there is a mismatch when the dataset contains a foreign variable name. I also know the foreign variable name/s will take the prefix of "var" and end with with a number greater than 4000 (because the total non-foreign variables are 4000).

The commands I have so far 
           
            foreach x1 of varlist var4###{
            capture confirm variable `x1'
              if _rc != 0 {
                display as err "There is a mismatch between variable names in the data"
                exit _rc
              }        
         

I know based on an earlier discussion on this list (Re: st: -confirm variable- does not accept varlist (wildcards)) that "capture confirm" command doesnt accept varlist, but does somebody have any alternative suggestions on how to programmatically achieve my goal above. 


Thanks
Paul 


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index