Procedure features: |
PROC SORT statement option:
|
|
Other features: |
PROC PRINT
|
This example
-
sorts the observations by the value of the first
variable
-
maintains the relative order with the EQUALS option
-
does not maintain the relative order with the NOEQUALS
option.
|
options nodate pageno=1 linesize=80 pagesize=60; |
|
data insurance;
input YearsWorked 1 InsuranceID 3-5;
datalines;
5 421
5 336
1 209
1 564
3 711
3 343
4 212
4 616
; |
|
proc sort data=insurance out=byyears1 equals; |
|
by yearsworked;
run; |
|
proc print data=byyears1; |
|
var yearsworked insuranceid; |
|
title 'Sort with EQUALS';
run; |
|
proc sort data=insurance out=byyears2 noequals; |
|
by yearsworked;
run; |
|
proc print data=byyears2; |
|
var yearsworked insuranceid; |
|
title 'Sort with NOEQUALS';
run; |
|
Sort with EQUALS 1
Years Insurance
Obs Worked ID
1 1 209
2 1 564
3 3 711
4 3 343
5 4 212
6 4 616
7 5 421
8 5 336 Sort with NOEQUALS 2
Years Insurance
Obs Worked ID
1 1 209
2 1 564
3 3 343
4 3 711
5 4 212
6 4 616
7 5 421
8 5 336
| |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.