Statalist


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

st: Function to identify data type


From   alvine.bissery@chu-lyon.fr
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index