Identifying Observations

Using the ID Statement in PROC PRINT

The ID statement identifies observations using variable values, such as an identification number, instead of observation numbers.
Syntax, ID statement in the PRINT procedure:
ID variable(s);
variable(s) specifies one or more variables to print whose value is used instead of the observation number at the beginning of each row of the report.

Example: ID Statement

In the following example, the OBS column in the output is replaced with the variable values for IDnum and LastName.
proc print data=cert.reps;
  id idnum lastname;
run;
Here is the output produced by PROC PRINT:
Figure 6.4 PROC PRINT: ID Statement Output

Example: ID and VAR Statement

You can use the ...

Get SAS Certification Prep Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.