[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Saving labels in macros

From   "Matt Spittal" <[email protected]>
To   <[email protected]>
Subject   st: RE: Saving labels in macros
Date   Tue, 12 Aug 2008 11:46:40 +1000


You can save value label in a macro using the macro extended functions.  For instance

	sysuse auto, clear
	local f0: label origin 0
	di "`f0'"

will get you want you want.  If you want to automate this process a little bit, try

	sysuse auto, clear

	levelsof foreign, local(levels)
	local lbe : value label foreign
	foreach l of local levels {
		local f`l' : label `lbe' `l'

	di "`f0' and `f1'"

This example uses an additional macro extended functions, -local lbe : value label foreign-, which returns the value label of the foreign variable. See -help extended_fcn- for more information.

-- Matt
[email protected]

-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Max Perez Leon
Sent: Tuesday, 12 August 2008 8:45 AM
To: [email protected]
Subject: st: Saving labels in macros

Dear Statalist Users,
I am trying to save the labels from a variable (not the code itself).  In this
case the variable is \"clas_tig\" and I want to save the labels from the following

clas_tig	Freq.	Percent	Cum.
INGRESOS CORRIENTES	14,722	32.12	32.12
INGRESOS DE CAPITAL	2,960	6.46	38.58
TRANSFERENCIAS	14,692	32.05	70.63
FINANCIAMIENTO	13,460	29.37	100.00
Total	45,834	100.00

because i want to use this labels later for titles of graphs i am going to do
for each category of \"clas_tig\" separately.
Thanks for your time.

Best Regards,
Max Perez Leon



*   For searches and help try:

*   For searches and help try:

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