How can I delete first words from a variable and retain the remaining words. Please find below an example of my data set. I want to rename the variable and keep only the first word. For example ,my first variable is respondentgewog_dzongkhag, I want to rename it and keep gewog_dzongkhag. Ofcourse I can use rename but I have to do that for the other 100 variables. Is there a faster way since the word to be deleted is only "respondent" from all variables.
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str16 respondentgewog_dzongkhag str23 respondentgewog str75 respondentorg_name float(respondentfieldnamelatitude respondentfieldnamelongitude) int respondentfieldnamealtitude float respondentfieldnameaccuracy str18 respondentservice "trashigang" "kangpara" "Gewog" 27.12458 91.69782 0 20 "procurementofworks" "trashigang" "kangpara" "Gewog" 27.0907 91.63435 1616 4.5509996 "procurementofworks" "sarpang" "sershong" "Shershog" 26.88797 90.55009 295 13.653 "procurementofworks" "sarpang" "chhuzaggang" "Chuzaggang" 26.86816 90.52514 211 12.136 "other" "trashigang" "kangpara" "Khangpara Gewog" 27.126986 91.70812 0 3599.999 "procurementofworks" "trashigang" "kangpara" "Kangpar Gewog" 27.127054 91.71771 1801 7 "procurementofworks" "trashigang" "kangpara" "Kangpara gewog" 27.17652 91.80563 0 0 "procurementofworks" "sarpang" "sershong" "SERSHONG GEWOG" 26.890184 90.53951 285 7.585 "other" "samtse" "tendruk_tendu" "Tendu Gewog Administration" 27.12628 88.87532 946 10.619 "other" "samtse" "tendruk_tendu" "Dawa Dema construction" 27.12633 88.87543 979 8 "procurementofworks" end
Thank you
0 Response to Delete words and rename variables
Post a Comment