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

Can anyone tell me what this statement is doing?

pot = 2 ## ( (n-1):0 );

 

If n is 3 it creates pot that equals 4 2 0.

 

But I don't understand the (n-1):0 indexing

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

The colon creates a vector of values, from (in your case) n-1 all the way down to 0, by 1.

 

So when n=3, this produces a vector with values

 

2 1 0

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

The colon creates a vector of values, from (in your case) n-1 all the way down to 0, by 1.

 

So when n=3, this produces a vector with values

 

2 1 0

--
Paige Miller
Sanscrit_2prov
Obsidian | Level 7

Thank you!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 477 views
  • 1 like
  • 2 in conversation