Statalist


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

st: problems on the string functions


From   gjhxmu@sina.com
To   statalist<statalist@hsphsun2.harvard.edu>
Subject   st: problems on the string functions
Date   Thu, 19 Nov 2009 23:51:03 +0800

Dear statalists,
I have two problems on -string functions-.
1. I want to replace the second word in a string varible with another word. What is the right function?
I have looked up string functions. Unluckily, no findings.
BTW, I found -word()- was maybe useful for what I want to do. However, missing values were always caused when I applied.
For example,

clear
input str6 v1
123
abc
2da
end
l
g v2=word(v1,2)

The result window showed "(3 missing values generated)" .

Could anyone tell me why?


2.I have two string variables v1 and v2. I want to generate a new variable v3 as following.

v1      v2  v3
abc123 123 abc
ab45   b45 a
cdef67 f67 cde

How to deal with it?

Thank you for any help.

Best regards
Rose

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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