Indiana University
University Information Technology Services
  
What are archived documents?

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:

DATA market_new; SET mydata_old; id = _N_; RUN;

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:

This is document adxp in domain all.
Last modified on November 05, 2008.
Please tell us, did you find the answer to your question?