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 at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: to replace just one character of values of a variabl


From   carmen gamarra <carmengamarra@hotmail.com>
To   stata list <statalist@hsphsun2.harvard.edu>
Subject   RE: st: to replace just one character of values of a variabl
Date   Sun, 25 Apr 2010 22:26:26 +0000

hi Martin,
 
thank you 
 
It funtioned, also!!
carmen 
 		 	   		  

----------------------------------------
> From: martin.weiss1@gmx.de
> To: statalist@hsphsun2.harvard.edu
> Subject: RE: st: to replace just one character of values of a variabl
> Date: Sun, 25 Apr 2010 22:36:11 +0200
>
>
> <>
>
> So, back on the home base, here is an example -replace-ing char(64) with nothing:
>
> *******
> clear*
>
> inp str10 mystrvar
> "hello"
> "goo@d-bye"
> "he@lo"
> "goo@d-bye"
> "hello"
> "hello"
> end
>
> list, noo
>
> replace mystrvar=subinstr(mystrvar,"`=char(64)'","",.)
>
> list, noo
> *******
>
>
> Your -replace- call did not say what you wanted Stata to do once the -if- qualifier was true.
>
> HTH
> Martin
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
> Sent: Sonntag, 25. April 2010 21:54
> To: statalist@hsphsun2.harvard.edu
> Subject: RE: st: to replace just one character of values of a variabl
>
> <>
> Not so, as you have found out already. My mobile has no Stata, so I am not able to comment authoritatively, but look at -help subinstr-.
>
> HTH
> Martin
>
> -original message-
> Subject: st: to replace just one character of values of a variabl
> From: carmen gamarra 
> Date: 25-04-2010 21:09
>
> <>
>
> Hello people,
>
> I imagined that a variation of the same command
> *****
> drop if strpos(mystrvar, "`=char(191)'")!=0
> *********
> could be used to replace just one character of values of a variable.
>
> I tried this but didn't function
>
> *****
> replace if strpos(var1, "`=char(64)'")!=0
> *********
>
> Please Help me!
>
>
> Thanks Carmen
>
>
>
>
>
>
> <>
>
>
> Stata will delete those happily if you find a way to tell it what to -drop-.
> In this case, -ssc d asciiplot- by Nick Cox tells you which number to pass
> to -char()- to check for the presence of the character:
>
> *******
> clear*
>
> inp str10 mystrvar
> "hello"
> "goo¿d-bye"
> "he¿lo"
> "goo¿d-bye"
> "hello"
> "hello"
> end
>
> list, noo
>
> drop if strpos(mystrvar, "`=char(191)'")!=0
>
> list, noo
> *******
>
>
> HTH
> Martin
>
> <>
>
> hello people,
>
>
> Another question, stata could delete
> all the row of a variable containing characters like
> "¿", for example.
>
>
> Thanks Carmen
>
> _________________________________________________________________
>
>
> *
> * 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/
>
>
> *
> * 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