Statalist


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

st: RE: Saving labels in macros


From   "Matt Spittal" <Matt.Spittal@cancervic.org.au>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Saving labels in macros
Date   Tue, 12 Aug 2008 11:46:40 +1000

Max,

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
Matt.Spittal@cancervic.org.au
  


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Max Perez Leon
Sent: Tuesday, 12 August 2008 8:45 AM
To: statalist@hsphsun2.harvard.edu
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
tabulation:

----------------------------------------------------------
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.

Saludos,
Best Regards,
Max Perez Leon
PUCP-IEP

			





         

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

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index