BookmarkSubscribeRSS Feed
kwu
SAS Employee kwu
SAS Employee
I find this in the sas doc about initialing an array with a sequential integers.

It just says:

You can also use a shorthand notation for specifying a range of sequential integers. The increment is always +1.

but no example, I wonder if anyone would tell me what is it and how to do it?
thank you
1 REPLY 1
ArtC
Rhodochrosite | Level 12
The sytax is the first and last values separated by a colon (you gotta love the colon it does so much for us). Here the array x will range from 10 to 15.
[pre]array x{6} _temporary_ (10:15);[/pre]

The following step augments this definition by passing through a list of values twice.
[pre]data silly;
array x{10} _temporary_ (2*1:5);
do i = 1 to dim(x);
y= x{i};
put i= y= ;
end;
run;
[/pre]

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
  • 1 reply
  • 1180 views
  • 0 likes
  • 2 in conversation