Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: series of value labels and collapse


From   akonseig@uni-bonn.de
To   statalist@hsphsun2.harvard.edu
Subject   st: RE: RE: series of value labels and collapse
Date   Mon, 07 Jul 2003 19:52:04 +0200 (MES)

I tried your suggestion Nick, but it works only for the dummies derived from 
the last variable c3 and  partially as the last label defined "cana" was 
affected to all of the dummies.
I can't see why.
Here is the do file. Thank you.
Adama

version 7.0
use ctypes, clear
program define compo3
foreach var of local 0{ 
use ctypes, clear
sort id
local names1 "beans....	"
local names2 "Oelericultura..."
local names3 "Blackpepper....Cana"	

local cropnames "`names1' `names2' `names3'" 
local codes "`names1' `names2' `names3'" 
local i = 1
foreach x of local cropnames {
        local y : word `i' of `codes'
        lab define `x' 1 "`y'" 0 "no", modify
	  capture forvalues j=1/46{
	  label val `var'_d`j' `x'
	  }
	  local i = `i' + 1
}
end
local area "c1 c2  c3"
foreach k of local area {
 compo3 `k'
 } 
program drop compo3
exit

*
*   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/



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