Below is a simple macro I need to create for an assignment. But I am having an issue that I do not understand. The data is called homework.cereal and the name of it is assigned to a macro variable &name. It has a bunch of cereals, the manufacturer of the cereal, 12 numeric variables describing each cereal such as amount of protein, sugar etc. . The macro needs to be able to take any of the the numeric variables from the data set, for example sugar. And then it needs to create a macro variable for each brand where the value assigned to it is the mean amount of sugar for that brand. Everything in the macro seems to be good except that I keep getting errors that the name of the macro can't have a symbol it it. So it is reading &variable in the first argument of call symput as it is instead of putting in 'sugar'. How do i fix this? %macro create_macros(variable) ; title "Means of &variable by Manufacturer" ; proc means data = &name ; class manufacturer; var &variable ; output out = stats mean = ; run; data _null_; set stats; call symput("&variable"||manufacturer,&variable); run; %mend create_macros; error message : NOTE: Invalid argument to function SYMPUT('&variable_P'[12 of 25 characters shown],' 144.375') at line 232 column 175. Manufacturer=Post _TYPE_=1 _FREQ_=8 Sodium=144.375 _ERROR_=1 _N_=6 ERROR: Symbolic variable name &VARIABLE_QUAKEROATS must contain only letters, digits, and underscores.
... View more