07-18-2017 09:56 AM - edited 07-18-2017 09:58 AM
I have an issue trying to combine a call symput with a superq.
Using a PROC SQL INTO I create a macro variable cc which is something like
I want this macrovariable to be global and do this:
data _null_; call symput(cci,%superq(cc)); run;
But then I get this issue:
MPRINT(EXT): data _null_; MPRINT(EXT): call symput(cci,'1','5','13'); MPRINT(EXT): run; NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds NOTE: Line generated by the macro function "SUPERQ". 163 '1','5','13' _ 386 76 ERROR 386-185: Expecting an arithmetic expression.
ERROR 76-322: Syntax error, statement will be ignored.
Do you know what's wrong here?
Thanks for reply.
07-18-2017 10:04 AM
07-18-2017 10:04 AM
07-18-2017 10:06 AM
You can make it global by just using "%global your_macro_variable;," but this assumes it isn't global already. Are you creating it inside a macro and that is making it local?
07-18-2017 10:14 AM
Well, you could do it:
data _null_; call symput('cci',"'1','5','13'"); run; %put &cci.;
The real question is why. It is never a good idea to put quotes into a macro variable. Second, it is rarely a good idea to put lists into a macro variable. There are far better, simpler methods of working with data if you use Base SAS which is the programming language, rather than Macro which is a text generator.
07-18-2017 10:21 AM
What is the actual question here?
If you want to make a macro variable named CCI that has the quoted value of the macro varaible CC then you could just write.
%global cci; %let cci=%superq(cc);
If you want to create CC as global and populate its value using SQL INTO clause then just define it as global before writing to it.
proc sql noprint; %global cc ; select x into :cc separated by ',' ....
Need further help from the community? Please ask a new question.