If you really want a return code approach, check out -confirm- e.g.
. conf int Test
-----Original Message-----
From: Nichols, Austin [mailto:[email protected]]
Sent: Friday, September 10, 2004 4:58 PM
To: '[email protected]'
Subject: st: RE: Storage datatype in assert test
You could try
. local testtype: type Test
. if substr(`testtype'",1,3)=="str" {
<stuff to do to string vars, such as -destring- etc.>
. }
. else {
<stuff to do to numeric vars>
. }
<then stuff to do to all vars>
but the -syntax- command also gives you a lot of tools for this kind of
thing.
-----Original Message-----
From: Wallace, John [mailto:[email protected]]
Sent: Friday, September 10, 2004 4:40 PM
To: '[email protected]'
Subject: st: Storage datatype in assert test
Hi statalisters
I'm trying to build some error checking into an insheet process. I'm
expecting a variable to be stored as an integer, but occasionally it comes
in as a string. I'd like to trap that occurrence somehow, and -assert-
seems to be the logical route. The problem is that I can't figure out how
to assert that a variable is a particular storage type (or, conversely, not
a string). I've had a look through the manuals and it seems that the
Characteristics for the variable might figure into it. There doesn't seem
to be much in the way of examples though. Could someone help me out?
I figure the command I'm looking for would be something like
(a variable named Test is of the integer data storage type)
. assert `Test[DataType]' = "Int"
.
John Wallace�|�Research Associate�| Test Method Development
AFFYMETRIX, INC. | 3380 Central Expressway | Santa Clara, CA 95051 | Tel:�
408-731-5574 | Fax:� 408-481-0435
*
* 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/
*
* 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/
*
* 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/