{"id":1967,"date":"2023-05-11T22:38:58","date_gmt":"2023-05-12T02:38:58","guid":{"rendered":"https:\/\/www.kaichen.work\/?p=1967"},"modified":"2023-08-01T20:44:08","modified_gmt":"2023-08-02T00:44:08","slug":"useful-stata-command-to-rename-groups-of-variables","status":"publish","type":"post","link":"https:\/\/www.kaichen.work\/?p=1967","title":{"rendered":"Stata command to rename groups of variables"},"content":{"rendered":"<p>Swap variable names: <code>rename (v1 v2) (v2 v1)<\/code><\/p>\n<p>Lowercase (or uppercase, or propercase) groups of variable names: <code>rename V1 V2, lower<\/code> or <code>rename *, lower<\/code><\/p>\n<p>Add suffix _old to variables v1, v2, &#8230; for one or more digits: <code>rename v# =_old<\/code><\/p>\n<p>Remove suffix _old from all variables ending in _old: <code>rename *_old *<\/code><\/p>\n<p>The meaning of each specifier:<\/p>\n<p><a href=\"https:\/\/www.kaichen.work\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-11-at-10.37.28-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1969\" src=\"https:\/\/www.kaichen.work\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-11-at-10.37.28-PM.png\" alt=\"\" width=\"344\" height=\"200\" srcset=\"https:\/\/www.kaichen.work\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-11-at-10.37.28-PM.png 774w, https:\/\/www.kaichen.work\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-11-at-10.37.28-PM-300x174.png 300w, https:\/\/www.kaichen.work\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-11-at-10.37.28-PM-768x447.png 768w\" sizes=\"(max-width: 344px) 100vw, 344px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Swap variable names: rename (v1 v2) (v2 v1) Lowercase (or uppercase, or propercase) groups of variable names: rename V1 V2, lower or rename *, lower Add suffix _old to variables v1, v2, &#8230; for one or more digits: rename v# &hellip; <a href=\"https:\/\/www.kaichen.work\/?p=1967\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[17],"_links":{"self":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts\/1967"}],"collection":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1967"}],"version-history":[{"count":8,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts\/1967\/revisions"}],"predecessor-version":[{"id":2169,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts\/1967\/revisions\/2169"}],"wp:attachment":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}