Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Extended missing values for fixed (dictionary) files


From   Sergiy Radyakin <serjradyakin@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Extended missing values for fixed (dictionary) files
Date   Fri, 10 May 2013 12:15:06 -0400

Dear All,

I am using standard Stata's -infix- command to import a file in fixed
format to Stata. The file contains numeric data, with missing values
marked with non-numeric symbols. For example:

variable X in 3 first columns and variable Y in the 4 column

1110
2121
1230
3331
AAA0
2121
1220
ZZZ1
2220
1211

If I infix the file both AAA and ZZZ values will be converted to
system-missing dot-value and will not be distinguishable afterwards.
My current workaround is to import the variable as string, then do
replaces of values AAA and ZZZ to extended missings and destring the
rest.

Note that with the real file I can't use Stata's -filefilter- to
replace AAA to .a before infixing since there is no guarantee the
value AAA will not occur in further columns of the data (data contains
string values as well, not shown in the above example).

QUESTION: Is there any way to specify how the non-numeric values are
to be treated during the infix? Is there any better strategy to do
recodes on the fly? I wish the syntax of dictionary could be extended
to something like:

1: int x 1-3; "AAA"=.a, "ZZZ"=.z

Thank you, Sergiy
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index