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?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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 save with the early bird rate—just $795!
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.