In SAS, how can I assign serial numbers to observations in a data set?
To assign serial numbers to observations in a data set in SAS, create a
variable using _N_, a system variable, which contains
observation numbers from 1 through n. Consider the following example:
The id = _N_; copies observation numbers to the variable
id.
For more information about statistical and mathematical software, email the UITS Stat/Math Center, visit the center's web page, or phone 812-855-4724 (IUB) or 317-278-4740 (IUPUI). The center is located in Bloomington at 410 N. Park Avenue, and is open for consultation by appointment Monday-Friday 9am-5pm.
Also see:
- During a SAS session, how do I redirect the work files?
- In SAS, how can I randomly assign half the cases to one group and the remaining half to another?
This is document adxp in domain all.
Last modified on November 05, 2008.
Last modified on November 05, 2008.
Please tell us, did you find the answer to your question?






