Statalist


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

st: Function to identify data type


From   [email protected]
To   [email protected]
Subject   st: Function to identify data type
Date   Tue, 26 Feb 2008 13:17:19 +0100

Dear all, 

I would like to generate new variables using this command:

for var  X1-X50 :replace X_new=1 if X=="New" 

But some Xi variables are numeric because empty

This command stops when one of the Xi is numeric 

How can I ask to execute this command only for string Xi variables ?  Is
there a "format" function which returns the type of the variable ? If this
exists, I could use:

for var  X1-X50 :replace X_new=1 if X=="New" & format(X)==string

Thank you

Alvine Bissery





*****************************************************
Alvine BISSERY
Ing�nieur statisticien 
Service de Biostatistique des Hospices Civils de Lyon 
162 Avenue Lacassagne 
69424 Lyon Cedex 03 - France 
t�l: +33 4 72 11 57 55 
fax: +33 4 72 11 51 41 


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