scalar a = 10
scalar b = "hello" // Double quotes are mandatory.
scalar dir // Displays all scalars.
scalar list // Same as scalar dir.
scalar drop a // Drops scalar a.
scalar drop _all // Drops all scalars.
clear
set obs 100
gen a = _n // Creates a variable containing the number of each observation.
scalar a = 10 // Creates a scalar containing the value 10.
scalar b = 5
generate product1 = a * b
// Multiplies the variable a with the scalar b. So product1 contains the number of each observations times 5.
generate product2 = scalar(a) * b
// Multiplies the scalar a with scalar b. So product2 is a variable which always contains the number 50.
// -> don't assign the same name to a scalar and a variable, preference will be given to the variable