Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: cut string variables

From   "Sebastian F. Büchte" <>
Subject   Re: st: cut string variables
Date   Tue, 23 May 2006 09:35:12 +0200


your solution will leave Susanne with her original problem, having a
variable with more than 80 characters. So building on your approach I
would suggest:

//generate word2, containing all characters from variable word1 located at
//position 51 or greater
gen str word2=substr(word1,51,.)

//replace word1 with an extract of its first 50 characters max
replace word1=substr(word1,1,50)

//make sure word1 is no longer a str102 type
compress word1


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index