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

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
Fluorite | Level 6

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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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