BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Sean_OConnor
Obsidian | Level 7

Morning,

 

I'm wondering for character format is it correct to list it as such?

 

'A00-A14','A20-A38','A40-A99','B01-B14','B25-B89','B91-B99'='All codes of interest'

'V01'-'V99' = 'New codes'

Or do you need to list all individual codes

 

'A01',
'A02',
'A03'='All codes used here'
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Try

'A00'-'A14'
'A00-A14'

constitutes a single string, not a range.

But be aware that a lot of values lie between A00 and A14, like 'A1 '. So you probably want to use

'A00'-'A09','A10'-'A14'

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

Try

'A00'-'A14'
'A00-A14'

constitutes a single string, not a range.

But be aware that a lot of values lie between A00 and A14, like 'A1 '. So you probably want to use

'A00'-'A09','A10'-'A14'
Sean_OConnor
Obsidian | Level 7

Many thanks for this. If I know from my data that the values must be of length three, should I get the same from the following?

 

"A01",
"A02",
"A03",
"A04",
"A05",
"A06",
"A07",
"A08",
"A09",
"A10",
"A11",
"A12",
"A13",
"A14"='My codes'

"A01"-"A14"='My codes'

I'm curious as I've done the following

 

'A00-A14','A20-A38','A40-A99','B01-B14','B25-B89','B91-B99'='90000 Other codes'

And my proc summary is not producing any results even though I know my dataset has codes such as A04 etc.

 

 

ballardw
Super User

@Sean_OConnor wrote:
'A00-A14','A20-A38','A40-A99','B01-B14','B25-B89','B91-B99'='90000 Other codes'

And my proc summary is not producing any results even though I know my dataset has codes such as A04 etc.

 

 


To determine what is wrong would require 1) your data set, 2) your proc summary and apparently 3) the complete definition of the format.

 

But if your values are indeed 'A00' then the above doesn't do what you want because you are creating single value strings.

'A00-A14' is a single value, not a range. A range, which is problematic with character variables would be 'A00' - 'A14'

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 712 views
  • 0 likes
  • 3 in conversation