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

Re: st: Capturing the data type of a variable


From   Philip Ryan <[email protected]>
To   [email protected]
Subject   Re: st: Capturing the data type of a variable
Date   Tue, 09 Mar 2004 09:44:42 +1030

use the extended function syntax of -local-  (see help macro).

for example:

. sysuse auto
(1978 Automobile Data)

. local k: type price

. local m: type make

. di "price `k'   make `m'"
price int   make str18


Phil


At 12:01 PM 8/03/2004 -0500, you wrote:
I am looking to loop through each of the variables in my dataset and manipulate variables that are of data type str10 or more. Is there any way I can capture the data type of a variable? Neither describe or codebook seem to have return codes r( ) that would serve this purpose. If I can capture the variable type as a string, e.g., "byte", "str5", "integer" it would easy from there.

Much thanks,


*
* 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/
Philip Ryan
Associate Professor,
Department of Public Health
Associate Dean (Information Technology)
Faculty of Health Sciences
University of Adelaide 5005
South Australia
tel 61 8 8303 3570
fax 61 8 8223 4075
http://www.public-health.adelaide.edu.au/
CRICOS Provider Number 00123M
-----------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright. If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.

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