New variable with a specific value

Here is one example of how we can create a new variable with a specific value.

Practical example

gen sample=1

This creates a new variable called sample, for which all observations will have the value 1.

sum sample

browse sample