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

Hi there,

 

Just a silly question, the code is like: array cnt_ir_a{5} 8 cnt_ir_1-cnt_ir_5;

 

I am just wondering what does the number "8" mean here, is that the length?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @ForrestYao,

 

In addition to the length (in bytes) of each of the five variables it also indicates their type: numeric (for character variables it would be $8 or $1 or ...) -- like in a LENGTH statement.

 

In certain situations the "default length 8" would not apply and the "8" would be required to ensure length 8. Example:

data have;
array a[3] 4 cnt_ir_1-cnt_ir_3;
run;

data want;
array cnt_ir_a{5} cnt_ir_1-cnt_ir_5;
set have;
run;

Without the length specification in the second ARRAY statement the first three variables inherit their length 4 from dataset HAVE.

View solution in original post

2 REPLIES 2
ballardw
Super User

@ForrestYao wrote:

Hi there,

 

Just a silly question, the code is like: array cnt_ir_a{5} 8 cnt_ir_1-cnt_ir_5;

 

I am just wondering what does the number "8" mean here, is that the length?

 

Thanks


Yes the 8 is the length, not needed as would be the default for numeric variables.

FreelanceReinh
Jade | Level 19

Hi @ForrestYao,

 

In addition to the length (in bytes) of each of the five variables it also indicates their type: numeric (for character variables it would be $8 or $1 or ...) -- like in a LENGTH statement.

 

In certain situations the "default length 8" would not apply and the "8" would be required to ensure length 8. Example:

data have;
array a[3] 4 cnt_ir_1-cnt_ir_3;
run;

data want;
array cnt_ir_a{5} cnt_ir_1-cnt_ir_5;
set have;
run;

Without the length specification in the second ARRAY statement the first three variables inherit their length 4 from dataset HAVE.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 536 views
  • 0 likes
  • 3 in conversation