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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 981 views
  • 0 likes
  • 2 in conversation