I run the data and got the results as following:
Original 2015 Average Allowed Amount | Projected 2017 Allowed Amount | Projected Percent Change |
$22,768.81 | $22,762.06 | -0.03% |
We have new data next year and I want to run the new data, but the years have to be updated into "2016" and "2018" respectively. The "
Original 2015 Average Allowed Amount" and "Projected 2017 Allowed Amount" are variable names in my data. I don't want to manually change the variable names each year. I tried to define macro variable names to update the years automatically, but I failed. Any ideas, suggestions and recommendations will be greatly appreciated!
Hi, you have a few options depending on what you want. You could say:
%let year=2018;
%let prev=%eval(&year-2);
title "Original &prev Average Allowed Amount" and "Projected &year Allowed Amount";
Then just change the first statement as needed.
Or if you know it is one year in the future and one year in the past.
%let next=%eval(%substr(&sysdate9, 6, 4)+1);
%let prev=%eval(&next-2);
title "Original &prev Average Allowed Amount" and "Projected &next Allowed Amount";
Hi, you have a few options depending on what you want. You could say:
%let year=2018;
%let prev=%eval(&year-2);
title "Original &prev Average Allowed Amount" and "Projected &year Allowed Amount";
Then just change the first statement as needed.
Or if you know it is one year in the future and one year in the past.
%let next=%eval(%substr(&sysdate9, 6, 4)+1);
%let prev=%eval(&next-2);
title "Original &prev Average Allowed Amount" and "Projected &next Allowed Amount";
Thank you!
It would help if you showed the code you tried and indicated what you're actual variable names are. Do they "really" have spaces in them, or are those just the variable labels?
Art, CEO, AnalystFinder.com
You may need to show your existing code to make suggestions pointed to specific items of your existing code.
Since "Original 2015 Average Allowed Amount" is definitely not a normal SAS variable name details could be critical to getting working code.
Yes, you are right. They are labels, not variable names. Sorry about this confusion. I used mbuchecker's code and added label statement and got it fixed. Thank you for your input!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.