BookmarkSubscribeRSS Feed
Quentin
Super User

This is mostly a teaser question.  Wondering if anyone has a good theory as to how an environment like below could be created, where SAS reports there are 2 global macro variables with the same name and different values.  I'm working on a (much longer) post where I will show how I think it's happening, and will ask more questions there.  Will add a link to that thread in the responses, but was curious as to whether folks had seen this sort of oddity before.

MPRINT(SHOW):   data _null_;
MPRINT(SHOW):   set sashelp.vmacro;
MPRINT(SHOW):   where name='G';
MPRINT(SHOW):   put (name scope offset value)(=);
MPRINT(SHOW):   run;
name=G scope=GLOBAL offset=0 value='TEST'
name=G scope=GLOBAL offset=0 value=GLOBAL

--Q.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
7 REPLIES 7
Quentin
Super User

Maybe I failed to pique much interest... Here is a link to the long post where I decribe how I managed to create two global macro variables with the same name, and ask for help in understanding how it happened....

https://communities.sas.com/message/130850

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Ksharp
Super User

SAS is not Object Oriented Programming language - like Java.

Quentin
Super User

Agreed Ksharp, but not sure I see your point.

Even though SAS is not object-oriented there are still "rules" in SAS's design about what should be unique.  So you can't have two datasets in the same library with the same name, can't have two variables in the same dataset with the same name, can't have two different title1 lines defined at the same time.  In the same way, I don't see how it can make sense for there to be two global macro variables with the same name at the same time.  Seems bug-ish to me.

--Q.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Patrick
Opal | Level 21

Agree - seems bug-ish to me as well. Suggest you send this one to SAS TechSupport.

FriedEgg
SAS Employee

I think you brought this up on SAS-L also.  It is an interesting situation.  Seems to only occur in 9.3 and not in 9.2.  So, it certainly seems as though it is a bug with the scope of programs executed in this unique fashion.

Quentin
Super User

FriedEgg,

Yes, it's the same issue I brought up on SAS-L.  Just thought I would put it out here as well to collect as much feedback / suggestions as I could, before going to tech support with it.  And was surprised by Ksharp's response.

--Q.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Ksharp
Super User

HeHe.

I agree with you that you cann't have two variables with the same name wthin the same dataset. Maybe you should contact with Technical Support.

Nowadays, I am learning JAVA (JavaEE) , So it is not problem for OOP. An object ( a macro variable) can have two fields ( values).

Ksharp

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
  • 7 replies
  • 1101 views
  • 0 likes
  • 4 in conversation