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.
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
SAS is not Object Oriented Programming language - like Java.
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.
Agree - seems bug-ish to me as well. Suggest you send this one to SAS TechSupport.
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.
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.
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.