Copy of an existing variable

Making a copy of an existing variable is highly useful e.g. when you want to experiment with a variable or to recode a variable without altering the original version.

Practical example

Dataset
StataData1.dta
Variable namegpa
Variable labelGrade point average (Age 15, Year 1985)
Value labelsN/A
gen gpa2=gpa

As can be seen below, the new variable gpa2 will be an exact copy of the old variable gpa.

sum gpa gpa2

browse gpa gpa2