Skip to content
9to5sas
  • Index
  • Glossary
Facebook Twitter Instagram Email RSS

  • Start Here
  • Base SAS
  • Advanced SASExpand
    • SAS Macros
    • PROC SQL
  • SAS/STATSExpand
    • SAS Analytics
    • Statistics
  • SAS Programs
9to5sas

9to5sas » Base SAS » Default Sorting Order of Characters in SAS

Default Sorting Order of Characters in SAS

BySubhro Posted onJanuary 12, 2021August 1, 2022 Last Updated:August 1, 2022
0 Comments

Sorting Orders for Numeric Variables Numeric variables are sorted from the smallest-to-largest comparison, and the sequence is below. SAS System missing values…

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 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!

Check your inbox or spam folder to confirm your subscription.

Subhro

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.

Facebook Twitter Linkedin

Post navigation

Previous Previous
5 ways to exit from a SAS data step or a Program
NextContinue
4 Methods to find values in one table that are in another table

SAS Tips in your inbox

Subscribe to 9to5sas for timely SAS tips and news delivered each month.
Learn about the latest articles, and code samples to keep your SAS skills fresh!

Your subscription is successful!

Recent Posts

  • Concatenate strings in SAS: The CAT Functions Demystified
  • 5 Techniques for Quickly Removing Leading Zeros in SAS
  • Troubleshoot Your Proc SQL Code Like a Pro with These 7 Automatic Macro Variables
  • 7 PROC SQL Options You Should Use to Debug Queries
  • How To Use The SAS Proc SQL Order By Statement?
9to5sas
  • Privacy Policy
  • Disclaimer
  • About
  • Contact
Facebook Twitter Instagram RSS Email Pinterest

Copyright © 2023 9TO5SAS, All rights reserved.

Scroll to top
  • 9to5sas Blueprint
  • About
  • About
  • Acceptable use policy
  • calculator
  • Confirm email
  • Contact
  • Contact
  • Cookie Policy
  • DISCLAIMER
  • Getting Started with SAS
  • Glossary
  • Index
  • Post #13801
  • Privacy Policy
  • Privacy policy
  • SAS Programs
  • Styles
  • Subscription confirmed
  • Terms and conditions
  • Thank You