BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
FP12
Obsidian | Level 7

Hi everyone,

 

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

'1','5','13'

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.

1 ACCEPTED SOLUTION
5 REPLIES 5
FP12
Obsidian | Level 7

Thanks to all for replies.

The easiest, the best. 

I didn't thik about this 😞

collinelliot
Barite | Level 11

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?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Tom
Super User Tom
Super User

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 ',' ....

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1062 views
  • 2 likes
  • 5 in conversation