[R] problem: try to passing macro value into submit block

Kai Yang y@ngk@|9999 @end|ng |rom y@hoo@com
Wed Dec 22 03:00:00 CET 2021


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]]



More information about the R-help mailing list