360Studies

Your Destination for Career Excellence in Bioscience, Statistics, and Data Science

Rename a variable in Stata

rename-a-variable-in-stata

Before starting this exercise, you should have the “Digital.dta” file. (Download link is given below)

Click here to download“Digital.dta”

Importing the “Digital.dta” file.

set maxvar 10000
use "/Users/pankajchowdhury/Downloads/Digital.dta"

I have the file located at "/Users/pankajchowdhury/Downloads/Digital.dta". Feel free to modify the file path according to your needs.

Result :

Observations:724115
Variables:31
Variable nameStorage typeDisplay formatValue labelVariable label
v005long%12.0gv005women's individual sample weight (6 decimals)
v013byte%8.0gV013age in 5-year groups
v024byte%8.0gV024state
v025byte%8.0gV025type of place of residence
v130byte%8.0gV130religion
v133byte%8.0gV133education in single years
v151byte%8.0gV151sex of household head
v157byte%8.0gV157frequency of reading newspaper or magazine
v158byte%8.0gV158frequency of listening to radio
v159byte%8.0gV159frequency of watching television
v169abyte%8.0gV169Aowns a mobile telephone
v190byte%8.0gV190wealth index combined
v217byte%8.0gV217knowledge of ovulatory cycle
v504byte%8.0gV504currently residing with husband/partner
v702byte%8.0gV702husband/partner's highest year of education (at level in v701)
v704byte%8.0gV704husband/partner's occupation
v715byte%8.0gV715husband/partner's total number of years of education
v730byte%8.0gV730husband/partner's age
v743fbyte%8.0gV743Fperson who usually decides what to do with money husband earns
v746byte%8.0gV746respondent earns more than husband/partner
d005long%12.0gd005weight for domestic violence (6 decimals)
d102byte%8.0gd012number of control issues answered 'yes' (d101x = 1)
sweightlong%12.0gsweightsample weight (6 decimals) (state level)
s116byte%8.0gS116belong to a scheduled caste, a scheduled tribe, other backward class
s303int%8.0gS303time period not living with husband
s311byte%8.0gS311type of relationship to current husband,prior to marriage
s931byte%8.0gS931do you have a bank or savings account that you yourself use
s932byte%8.0gS932do you have any mobile phone that you yourself use
s933byte%8.0gS933do you use your mobile phone for any financial transaction ?
s934byte%8.0gS934have you ever used the internet?
s1004pbyte%8.0gS1004Psource of information about aids: internet

Code 1 : 

codebook v103

Explanation : codebook v103 – This command will check the variable type, variable label, Range, Unique values, value label and frequency distribution of that variable “v013”.

Result : 

Codebook :v013
Type: Numeric (byte)
Label: V013
Range: [1,7]Units: 1
Unique values: 7Missing :0/724,115
Tabulation:Freq.NumericLabel
1,22,480115-19
1,18,700220-24
1,18,379325-29
1,01,049430-34
98,068535-39
81,380640-44
84,059745-49

Code 2 : 

rename v013 FYAG

Explanation : rename v013 FYAG – This command will change the variable v013 name to FYAG (Five-year age group).

Code 3 : 

codebook FYAG

Explanation : codebook FYAG – This command will help you to cross check your previous results.

Results :

Codebook :FYAG
Type: Numeric (byte)
Label: V013
Range: [1,7]Units: 1
Unique values: 7Missing :0/724,115
Tabulation:Freq.NumericLabel
1,22,480115-19
1,18,700220-24
1,18,379325-29
1,01,049430-34
98,068535-39
81,380640-44
84,059745-49

Looking for latest updates and job news, join us on Facebook, WhatsApp, Telegram and Linkedin

You May Also Like

Scroll to Top