Hello, I am having trouble to generate code for an assignment.
Here is the Questions:
Add the title indicating what function you are plotting, in what range and ny what increment.
Run your macro as:
%exp_plot(.5, -10, 10, .5)
%exp_plot(-.5, -10, 10, .5)
%exp_plot(-.5, -10, 10, .5)
Here is the code i have so far:
%macro exp_plot(base,start,end,incr);
data plot1;
%do i=&start %to &end %by &incr;
result=&base**&i;
output;
%end;
run;
proc plot data=plot1;
plot result;
run;
%mend exp_plot;
%exp_plot(.5, -10, 10,.5)
%exp_plot(-.5, -10, 10,.5)
%exp_plot(-.5, -10, 10,.5)
Can someone please point me in the right direction?
OK. Two hints.
1. you have to increment %do loops with integers
2. I think proc plot will require that you plot two variables
OK. Two hints.
1. you have to increment %do loops with integers
2. I think proc plot will require that you plot two variables
Thank you Arthur, I managed to figure it out thanks to your hints. If I understand correctly, you cannot use non-integer values to increment in a %do loop therefore the problem is in the question as it is the question that requests us to use the value of 0.5 for incremental.
No.
Why are you using %do in a data step, use a regular do loop instead.
Is there a proc plot?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.