DATA Step, Macro, Functions and more

what is the shorthand notation in the sas doc

Reply
SAS Employee kwu
SAS Employee
Posts: 34

what is the shorthand notation in the sas doc

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
Valued Guide
Posts: 634

Re: what is the shorthand notation in the sas doc

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]
Ask a Question
Discussion stats
  • 1 reply
  • 239 views
  • 0 likes
  • 2 in conversation