Default Sorting Order of Characters in SAS

Default Sorting Order of Characters in SAS

Sorting Orders for Numeric Variables

Numeric variables are sorted from the smallest-to-largest comparison and the sequence is as 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 run;

ning.

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 Kar is an Analyst with over five years of experience. As a programmer specializing in SAS (Statistical Analysis System), Subhro also offers tutorials and guides on how to approach the coding language. His website, 9to5sas, offers students and new programmers useful easy-to-grasp resources to help them understand the fundamentals of SAS. Through this website, he shares his passion for programming while giving back to up-and-coming programmers in the field. Subhro’s mission is to offer quality tips, tricks, and lessons that give SAS beginners the skills they need to succeed.

Leave a Reply

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

Share via
Copy link
Powered by Social Snap