Previous Page | Next Page

The DATASETS Procedure

Example 9: Getting Sort Indicator Information


Procedure features:

APPEND statement option:

GETSORT

SORTEDBY data set option



Program

The following example shows that a sort indicator can be inherited using the GETSORT option with the APPEND statement.

 Note about code
data mtea;
    length var1 8.;
    stop;
run;
 Note about code
data phull;
    length var1 8.;
    do var1=1 to 100000;
    output;
end;
run;

proc sort data=phull;
    by DESCENDING var1;
run;

proc append base=mtea data=phull getsort;
run;

ods select sortedby;

proc contents data=mtea;
run;

Sort Information Output

   Sort Information
   Sortedby DESCENDING var1
   Validated YES
   Character Set ANSI
This example shows sort indicators using the SORTEDBY data set option and the SORT procedure.
 Note about code
data mysort(sortedby=var1);
    length var1 8.;
    do var1=1 to 10;
    output;
end;
run;

ods select sortedby;

proc contents data=mysort;
run;

Sort Information Output

   Sort Information
   Sortedby var1
   Validated NO
   Character Set ANSI

This example shows the sort indicator information using the SORT procedure.

 Note about code
data mysort;
    length var1 8.;
    do var1=1 to 10;
    output;
end;
run;

proc sort data=mysort;
    by var1;
run;

ods select sortedby;

proc contents data=mysort;
run;

Sort Information Output

   Sort Information
   Sortedby var1
   Validated YES
   Character Set ANSI

Previous Page | Next Page | Top of Page