Default Sorting Order of Characters in SAS

Default Sorting Order of Characters in SAS

  • Post author:
  • Post category:Base SAS
  • Post comments:0 Comments
  • Reading time:5 mins read

Sorting Orders for Numeric Variables

Numeric variables are sorted from the smallest-to-largest comparison, and the sequence is below.

  • SAS System missing values (shown as a period or special missing value)
  • negative numeric values
  • zero
  • positive numeric values.

Sorting Orders for Character Variables

PROC SORT uses either the EBCDIC or the ASCII collating sequence when it compares character values, depending on the environment under which the procedure is running.

In the EBCDIC sequence, lowercase characters are sorted first, followed by upper characters and then the digits. Note that some special characters interrupt the alphabetic sequences. The blank is the smallest displayable character.

Actual Number in ASCII sorting Sequence Characters
#032  
#033 !
#034  
#035 #
#036 $
#037 %
#038 &
#039  
#040 (
#041 )
#042 *
#043 +
#044 ,
#045
#046 .
#047 /
#048 0
#049 1
#050 2
#051 3
#052 4
#053 5
#054 6
#055 7
#056 8
#057 9
#058 :
#059 ;
#060 <
#061 =
#062 >
#063 ?
#064 @
#065 A
#066 B
#067 C
#068 D
#069 E
#070 F
#071 G
#072 H
#073 I
#074 J
#075 K
#076 L
#077 M
#078 N
#079 O
#080 P
#081 Q
#082 R
#083 S
#084 T
#085 U
#086 V
#087 W
#088 X
#089 Y
#090 Z
#091 [
#092 \
#093 ]
#094 ^
#095 _
#096 `
#097 a
#098 b
#099 c
#100 d
#101 e
#102 f
#103 g
#104 h
#105 i
#106 j
#107 k
#108 l
#109 m
#110 n
#111 o
#112 p
#113 q
#115 s
#116 t
#117 u
#118 v
#119 w
#120 x
#121 y
#122 z
#123 {
#124 |
#125 }
#126 ~

Every week we'll send you SAS tips and in-depth tutorials

JOIN OUR COMMUNITY OF SAS Programmers!

Subhro

Subhro provides valuable and informative content on SAS, offering a comprehensive understanding of SAS concepts. We have been creating SAS tutorials since 2019, and 9to5sas has become one of the leading free SAS resources available on the internet.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.