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;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 2395 views
  • 2 likes
  • 3 in conversation