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]

Re: st: Re: Equivalent to matcell in table


From   Eric Booth <ebooth@ppri.tamu.edu>
To   "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Re: Equivalent to matcell in table
Date   Wed, 14 Jul 2010 17:59:10 +0000

<>

2 ideas: 
***************!
clear
inp str10 model
"sx200"
"nx200"
"302a"
"1111"
end


**1.  add m_ to all strings in a var**
g model2 = "m_" + model

**or**

**2. just the strings that start with a number**
clonevar model3 = model
forval n = 0/9 {
	g pos`n' = strpos(model3, "`n'")
	replace model3 = "m_" + model3 if pos`n'==1
	 drop pos`n'
	}
li
***************!

Also, you might consider appending or joining the 45 datasets together first and then making modifications.

~ Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754



On Jul 14, 2010, at 12:40 PM, Hobst wrote:

> Thanky you. i did it! But somehow different
> 
> I cleanes up the Variables and then just
> 
> reshape wide table1, i(Traded_Model) j(NewModel) string
> 
> and it almost worked.
> 
> I had to rename all the Models that begin with an number , for example 200SX
> by n2000SX.
> I did that manually Model by Model... Is there an easier way how to do that?
> (identify all the Traded_Model and NewModel that start with a number and put
> a "n" in front of it) I need a more automated approach, because i need to do
> steps i did today for 45 other Datasets, which do not necessarily contain
> the same model names...
> 
> After that it worked fin :)... Thank you so much all your help
> 
> 
> 
> -- 
> View this message in context: http://statalist.1588530.n2.nabble.com/Equivalent-to-matcell-in-table-tp5285038p5293896.html
> Sent from the Statalist mailing list archive at Nabble.com.
> *
> *   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/




*
*   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   |   Site index