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

Hello team,

This is my code, it runs successfully; it gives me only a line. How to view the increase year by year:

data salyr;  
input salary year;  
cards;  
134 2019  
run;

data increaseit;
set salyr;
do until (salary gt 1000);
salary = salary + salary * 0.06;
year = year + 1;
end;
output;
Run;


Thanks,
Blue Blue
Blue Blue
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Here are a few ways, the method depends on what you're trying to do next:

 

  • Move the OUTPUT line to within the loop to create an output record for each iteration of the loop
  • Use the debugger
  • Use a PUT statement in the loop to show variables values

@GN0001 wrote:

Hello team,

This is my code, it runs successfully; it gives me only a line. How to view the increase year by year:

data salyr;  
input salary year;  
cards;  
134 2019  
run;

data increaseit;
set salyr;
do until (salary gt 1000);
salary = salary + salary * 0.06;
year = year + 1;
end;
output;
Run;


Thanks,
Blue Blue

 

View solution in original post

1 REPLY 1
Reeza
Super User

Here are a few ways, the method depends on what you're trying to do next:

 

  • Move the OUTPUT line to within the loop to create an output record for each iteration of the loop
  • Use the debugger
  • Use a PUT statement in the loop to show variables values

@GN0001 wrote:

Hello team,

This is my code, it runs successfully; it gives me only a line. How to view the increase year by year:

data salyr;  
input salary year;  
cards;  
134 2019  
run;

data increaseit;
set salyr;
do until (salary gt 1000);
salary = salary + salary * 0.06;
year = year + 1;
end;
output;
Run;


Thanks,
Blue Blue

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1 reply
  • 538 views
  • 1 like
  • 2 in conversation