BookmarkSubscribeRSS Feed
KiranMaddi
Obsidian | Level 7

Hi all, Can someone help me out with this issue?


%MI(PC,NBS,%nrstr(M&S),MNS,%nrstr(M&S));

A = Compress("M&S"||'%');

MPRINT(MI): Call Symput('Table_Brand',A);


SYMBOLGEN: Macro variable TABLE_BRAND resolves to M&S%

WARNING: Apparent symbolic reference S not resolved.


What could be the issue?

16 REPLIES 16
ChrisNZ
Tourmaline | Level 20

The issue is that sas is trying to find macro variable S in expression

A = Compress("M&S"||'%');


Try

A = Compress('M&S'||'%');

or even

A = Compress('M&S%');

or even

A = 'M&S%';

Tom
Super User Tom
Super User

Let's assume that what you posted is actually the lines generated by MPRINT from lines in the %MI() macro that looked like:

A = Compress("&XXX"||'%');

Call Symput('Table_Brand',A);


If you need to do that in a DATA STEP then you could do:

Call SymputX('Table_Brand',compress(symget('XXX'))||'%');


Or in macro code with:

%let Table_Brand = %superq(XXX)%str(%%) ;



KiranMaddi
Obsidian | Level 7

Thanks guys for your help and apologies for the late reply

KiranMaddi
Obsidian | Level 7

Hello SAS experts, need a bit of help. I am trying to run a macro that generates reports in excel. Having running the same code with two different macro variables. Why only one is producing reports with graphs and cover page and the other is not(just printing the data as it is in excel).Below you can find the difference in the output that is before the code sends them to excel. Please help me out. I have the examples of reports in case if you need it.

Note: There see no code in the macros that creates the graphs and cover page.


                                         #  Name                          Type    Type

                                        1  'Agg Graphs$'                 DATA    TABLE     

                                        2  'Agg Graphs$'Print_Area       DATA    TABLE     

                                        3  'DI Graphs$'                  DATA    TABLE     

                                        4  'DI Graphs$'Print_Area        DATA    TABLE     

                                        5  'Direct Internet$'            DATA    TABLE     

                                        6  'Direct Internet$'Print_Area  DATA    TABLE     

                                        7  'Price Change List$'          DATA    TABLE     

                                        8  'Tele Graphs$'                DATA    TABLE     

                                        9  'Tele Graphs$'Print_Area      DATA    TABLE     

                                       10  A                             DATA    TABLE     

                                       11  Aggregator$                   DATA    SYSTEM TABLE

                                       12  Aggregator$Print_Area         DATA    TABLE     

                                       13  Changes                       DATA    TABLE     

                                       14  Contents$                     DATA    SYSTEM TABLE

                                       15  Contents$Print_Area           DATA    TABLE     

                                       16  Cover$                        DATA    SYSTEM TABLE

                                       17  Cover$Print_Area              DATA    TABLE     

                                       18  Flag                          DATA    TABLE     

                                       19  In                            DATA    TABLE     

                                       20  TSn                           DATA    TABLE     

                                       21  Telesales$                    DATA    SYSTEM TABLE

                                       22  Telesales$Print_Area          DATA    TABLE     

                                       23  Tn                            DATA

                                                   



                                                    1  A     DATA    TABLE     

                                                    2  A$    DATA    SYSTEM TABLE

                                                    3  Bn    DATA    TABLE     

                                                    4  Bn$   DATA    SYSTEM TABLE

                                                    5  IFn   DATA    TABLE     

                                                    6  IFn$  DATA    SYSTEM TABLE

                                                    7  INn   DATA    TABLE     

                                                    8  INn$  DATA    SYSTEM TABLE

                                                    9  TFn   DATA    TABLE     

                                                   10  TFn$  DATA    SYSTEM TABLE

                                                   11  TNn   DATA    TABLE     

                                                   12  TNn$  DATA    SYSTEM TABLE

                                                   13  TSn   DATA    TABLE     

                                                   14  TSn$  DATA    SYSTEM TABLE

                                                   15  Tn    DATA    TABLE     

                                                   16  Tn$   DATA    SYSTEM TABLE

ChrisNZ
Tourmaline | Level 20

Way too little information here.

Typically, the graphs are probably already in excel and SAS just refreshes the data behind them.

KiranMaddi
Obsidian | Level 7

Hi Chris. I don't think the graphs are already in the Excel. If you see my question above you will see two tables. Those are the tables present in a library called myexcel. Then a piece of the following code sends them to excel.

Libname Myexcel pcfiles path="&output.\New Business Car\Monthly Pricing Pack - &Name..xls" Scan_Text = No;

Proc Datasets Library = myexcel;

Delete &Channel.n "&Channel.n.$"n;

Run;

quit ;

Data myexcel.&Channel.n ;

Set work.export_&Channel ;

  Run ;

My question is why the macros is not producing other tables like print area as you see it above in my question, with other parameters. I hope my explanation is not too complicated.

    Libname Myexcel clear;

ChrisNZ
Tourmaline | Level 20

As you can see, this piece of code just refreshes data. Nothing else.

KiranMaddi
Obsidian | Level 7

OK. Let's assume that Excel is refreshing data. Any suggestion of what resolves my issue?

Note: Please see the attached two different reports for clear understanding.

ChrisNZ
Tourmaline | Level 20

Also be sure never to reply, thank people who write answers and never to choose helpful/final answers. That's a great way to motivate people to help you.

KiranMaddi
Obsidian | Level 7

I am very new to this community. Anyway,I will keep that in mind Chris.

Astounding
PROC Star

Do you want A to be 200 characters long?  That's the impact of adding COMPRESS, and would also make &TABLE_BRAND 200 characters long.  Why not just:

A = 'M&S%';

No warnings, and no extra blanks.

KiranMaddi
Obsidian | Level 7

I have replaced macro with the actual variable. the actual code is A = Compress("&brand"||'%');. Any suggestion for resolving the excel issue? I have just attached the reports BIS( Which has cover and graphs) Halifax(Graphs and cover not produced).

Astounding
PROC Star

There's a little too much for me to work on there, but I would start with the message about BIS being uninitialized.  Do you expect to see a variable named BIS?  Should it have been assigned a value?

Good luck.

KiranMaddi
Obsidian | Level 7

Do not worry about the Warnings and errors as they have all been fixed. The only issue is with the excel reporting. When you run the code for Halifax you will have these tables  in my excel library which then sends the data to excel for reporting. Here excel is not producing graphs and cover pages. On the other hand the same code but the parameters are different(BIS) has produced graphs and cover in excel.

                                                                                                                     /////////////////(Halifax)////////////////////////////////

                                                    1  A     DATA    TABLE    

                                                    2  A$    DATA    SYSTEM TABLE

                                                    3  Bn    DATA    TABLE    

                                                    4  Bn$   DATA    SYSTEM TABLE

                                                    5  IFn   DATA    TABLE    

                                                    6  IFn$  DATA    SYSTEM TABLE

                                                    7  INn   DATA    TABLE    

                                                    8  INn$  DATA    SYSTEM TABLE

                                                    9  TFn   DATA    TABLE    

                                                   10  TFn$  DATA    SYSTEM TABLE

                                                   11  TNn   DATA    TABLE    

                                                   12  TNn$  DATA    SYSTEM TABLE

                                                   13  TSn   DATA    TABLE    

                                                   14  TSn$  DATA    SYSTEM TABLE

                                                   15  Tn    DATA    TABLE    

                                                   16  Tn$   DATA    SYSTEM TABLE

                                      

                                         //////////////(BIS)//////////////////////


                                        #  Name                          Type    Type

                                        1  'Agg Graphs$'                 DATA    TABLE    

                                        2  'Agg Graphs$'Print_Area       DATA    TABLE    

                                        3  'DI Graphs$'                  DATA    TABLE    

                                        4  'DI Graphs$'Print_Area        DATA    TABLE    

                                        5  'Direct Internet$'            DATA    TABLE    

                                        6  'Direct Internet$'Print_Area  DATA    TABLE    

                                        7  'Price Change List$'          DATA    TABLE    

                                        8  'Tele Graphs$'                DATA    TABLE    

                                        9  'Tele Graphs$'Print_Area      DATA    TABLE    

                                       10  A                             DATA    TABLE    

                                       11  Aggregator$                   DATA    SYSTEM TABLE

                                       12  Aggregator$Print_Area         DATA    TABLE    

                                       13  Changes                       DATA    TABLE    

                                       14  Contents$                     DATA    SYSTEM TABLE

                                       15  Contents$Print_Area           DATA    TABLE    

                                       16  Cover$                        DATA    SYSTEM TABLE

                                       17  Cover$Print_Area              DATA    TABLE    

                                       18  Flag                          DATA    TABLE    

                                       19  In                            DATA    TABLE    

                                       20  TSn                           DATA    TABLE    

                                       21  Telesales$                    DATA    SYSTEM TABLE

                                       22  Telesales$Print_Area          DATA    TABLE    

                                       23  Tn                            DATA

                                                  

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
  • 16 replies
  • 3110 views
  • 6 likes
  • 5 in conversation