Statalist


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

st: RE: xi help


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: xi help
Date   Thu, 27 Aug 2009 15:33:44 +0100

you didn't edit out all previous postings, but kept relevant material.
Also: use your mailer to reply, rather than sending new posts.] 

The possible issue here is that value labels in general need not be text
that qualifies as (not yet existing) variable names. Moleps knows that
his value labels are OK, but that need not be true in general. 

Either way, this problem has already been addressed in the program
-dummieslab- from SSC. -ssc inst dummieslab- to get a copy. Moleps, or
anyone else interested, would have seen a pointer to that if they had
typed 

. findit dummies 

Nick 
[email protected] 

moleps islon

In case anyone have the same needs, this program seems to do what I
want:

capture program drop tabgen
program tabgen
syntax varlist

tokenize `varlist'

foreach var of local varlist{

	 qui levelsof `var', local(`var'_lev)
	 foreach val of local `var'_lev {
      	
		gen _`:label `var' `val''=`var'==`val'
	}
 }
end


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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index