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: Question on data manipulation


From   Matthew White <mwhite@poverty-action.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Question on data manipulation
Date   Sat, 29 Oct 2011 17:50:04 -0400

Hi William,

If cusip is an integer and has numeric type:
replace cusip = int(cusip / 10)

If cusip has string type:
replace cusip = substr(cusip, 1, length(cusip) - 1)

Best,
Matt

On Sat, Oct 29, 2011 at 5:42 PM, William Pratt <williamrpratt@gmail.com> wrote:
> Dear Statalisters,
> I have the following string data of 9 characters and would like to
> drop the last value so that it becomes 8 characters. Thanks for your
> consideration.
>
> cusip
> 000360206                  >>>                           00036020
> 000360206                  >>>                           00036020
> 000360206                  >>>                           00036020
> 000360206                  >>>                           00036020
> 000360206                  >>>                           00036020
> 000361105                  >>>                           00036110
> 000361105                  >>>                           00036110
> 000361105                  >>>                           00036110
> 000361105                  >>>                           00036110
>
>
>
> --
> wrpratt@utpa.edu
> University of Texas-Pan American
> College of Business Administration
> Department of Finance and Economics
> South Texas Border Health Disparities Center
> o - 956.665.7937
> f - 956.665.7310
> *
> *   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/
>



-- 
Matthew White
Data Coordinator
Innovations for Poverty Action
101 Whitney Avenue, New Haven, CT 06510 USA
+1 434-305-9861
www.poverty-action.org

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