Hi team,I'm trying to pass macro variable into R script in Proc iml. I want to 
do change variable in color= and export the result with different file name.If 
I don't use macro, the code work well. But when I try to use macro below, I got 
error message: "Submit block cannot be directly placed in a macro. Instead, 
place the submit block into a file first and then use %include to include the 
file within a macro definition.". After reading the message, I still not sure 
how to fix the problem in the code. Anyone can help me?
Thank you,Kai
%macro pplot(a);proc iml;
submit / R;
library(ggplot2)library(tidyverse)
mpg %>%  filter(hwy <35) %>%   ggplot(aes(x = displ, y = hwy, color = &a)) +   
geom_point()ggsave("c:/temp/&a..jpg")
endsubmit;
quit;%mend;%pplot(drv);%pplot(cyl);

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to