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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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