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: Data format query


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Data format query
Date   Tue, 24 May 2011 09:24:53 +0100

-subinstr()- is a function, not a command.

This is not just a picky, persnickety, pedantic, precious point of
proper detail, although it is that too. Remembering the keyword
"function" is the way to remember to look under _functions_ in the
documentation when you next have a loosely similar problem. Or when
you next need -subinstr()-, but can't remember its name.

Stata users often spend a lot of time looking for a command when what
they need is a function.

Nick

On Tue, May 24, 2011 at 6:50 AM, Susan Olivia <susan.olivia@monash.edu> wrote:
> Thanks Ana. the 'subinstr' command that you suggested do what I after.


On 24 May 2011 15:23, Vitorino, Maria Ana <vitorino@wharton.upenn.edu> wrote:

>> I tried the following and it worked...
>>
>> replace Revenue= subinstr(Revenue,"_","",.)
>> replace Revenue= subinstr(Revenue,".","",.)

On May 24, 2011, at 12:08 AM, Susan Olivia wrote:

>>> I have the data in following format [plese see below]. Ideally I would
>>> like the data to display without the "__" and ".". I tried using the
>>> 'substr' command didn't really doing what I after. This variable is
>>> currently in string format. Unfortunately, encode, recode or replace
>>> didn't work either.

>>> . tab b44
>>>
>>> b44.Revenue |
>>>    /Amount   |      Freq.     Percent        Cum.
>>> ------------------ +-----------------------------------
>>> 160.000.000 |          1        0.03        1.84
>>> _10.000.000 |          3        0.08        1.92
>>> _10.100.000 |          1        0.03        1.94
>>> _10.200.000 |          2        0.05        2.00
>>> _10.210.000 |          1        0.03        2.02
>>> _10.800.000 |          4        0.10        2.13
>>> _11.000.000 |          4        0.10        2.23
>>> _11.087.200 |          1        0.03        2.26
>>> _11.844.000 |          1        0.03        2.28
>>> _18.000.000 |          9        0.23        3.66
>>> _19.456.800 |          1        0.03        3.68
>>> _20.000.000 |          8        0.21        3.89
>>> __7.500.000 |          3        0.08       17.35
>>> __7.600.000 |          1        0.03       17.37
>>> __7.820.000 |          1        0.03       17.40
>>> __8.000.000 |          5        0.13       17.53
>>> __8.300.000 |          1        0.03       17.55
>>> __8.400.000 |          3        0.08       17.63
>>> __9.000.000 |         10        0.26       17.89
>>> __9.200.000 |          1        0.03       17.92
>>> __9.600.000 |          6        0.16       18.07
>>> __9.800.000 |          1        0.03       18.10
>>> __9.850.000 |          1        0.03       18.12
>>> ___.100.000 |        102        2.64       20.77
>>> ___.100.750 |          1        0.03       20.79
>>> ___.100.800 |          1        0.03       20.82
>>> ___.102.000 |         22        0.57       21.39
>>> ___.102.500 |          2        0.05       21.44
>>> ___.103.000 |          1        0.03       21.47
>>> ___.103.760 |          1        0.03       21.49
>>> ___.104.400 |          2        0.05       21.55
>>> ___.104.500 |          1        0.03       21.57

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