Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Question on data manipulation


From   Matthew White <[email protected]>
To   [email protected]
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 <[email protected]> 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
>
>
>
> --
> [email protected]
> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index