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

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.

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
local area "c1 c2  c3"
foreach k of local area {
 compo3 `k'
program drop compo3

*   For searches and help try:

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