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

I have to print all the numbers less than 500 which is divisible by 7 in decreasing order WITHOUT using PROC SORT.

1 ACCEPTED SOLUTION
6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Why are you not allowed to use proc sort? 🙂

 

Are you allowed to use proc sort inside a call execute statement in the data step? 

abhaykumar
Obsidian | Level 7
To find some other method to solve this problem .
abhaykumar
Obsidian | Level 7
Proc sort is not been taught in class yet.
abhaykumar
Obsidian | Level 7
Thank You sir, I was trying this way but I was not knowing about "By -1" thing. and I guess we can increase or decrease by any value by using "by -/+n" step, right?
Kurt_Bremser
Super User

@abhaykumar wrote:
Thank You sir, I was trying this way but I was not knowing about "By -1" thing. and I guess we can increase or decrease by any value by using "by -/+n" step, right?

Correct. You can even use values with fractions.

Like

data test;
do i = 10 to 0 by -1.5;
  output;
end;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 6 replies
  • 2329 views
  • 2 likes
  • 3 in conversation