Statalist The Stata Listserver


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

st: changing strings


From   Molly Lipscomb <[email protected]>
To   [email protected], [email protected]
Subject   st: changing strings
Date   Sun, 22 Apr 2007 23:26:35 -0700 (PDT)

Hi everyone,

I have a large dataset that was too big for me to use find and replace in Excel for the missing values, so I have many variables that contain double periods .. for missing observations.  I want to change these to missing so that I can convert the variables to integers, but I am having trouble changing the string values to missing.  Here is my code right now:

foreach var in $varlist {
gen `var'1=subinstr(`var', ..,  , )
destring `var'1, replace
drop `var'
ren `var'1 `var'
}

I thought this would allow me to substitute a space for the double period, but it isn't working.

Any ideas?

Thanks a lot,
Molly



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
*
*   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