Prev: Error handling for interactive stored processes
Next: SAS - proc nlmixed & Cholesky Decomposition
From: rahul alawadhi on 3 Aug 2010 15:55 Hi all i have some problems coming in using calling autocall library. My first questions i how many auto call libraries can i call at one time ...is there any limit to call number of libraries. 2nd question is : is there any any order for calling up the autocall libraries filname a1 'c:\macro\a1' filname a2 'c:\macro\a2' 'filname a3 'c:\macro\a3' filname a4 'c:\macro\a4' options mautosource sasautos = (a1 a2 a3 a4); data xyz; set xyz; run; %a1 (dsn , a , b); %a2 (dsn , a , b); %a3 (dsn , a , b); %a3 (dsn , a , b); %a4 (dsn , a , b); when i am running my code , the first 2 macros , i am able to invoke and execute them , problem comes when i am invoking %a3 macro , it is just invoking itself but not executing , which causes %a4 macro (neither invocation nor executiion). but that macro is complied in Work.Sasmacr . But again when i re-run my code in the same session , %a3 macro is invoked as well as executed. but now %a4 macro is just invoked . and i can see in work.Sasmacr .... i have to again re-run my code to get the complete results . so that means 3 times i ahve to run the code. what all things should i take into account that my codes run fine in one go. i have also make sure fileaname and macro name should be same. can you please help me this situation. thanks rahul
From: Tom Abernathy on 3 Aug 2010 17:44 Rahul - You should not be having trouble where first instance loads, compiles and runs and the second does nothing. That sounds as if the code that is being included from the autocall library is NOT really a macro. So when it is included the first time it runs just the same as if you did a %INCLUDE on the file. The second time it runs SAS should find the already compiled macro and so not bother to include the file again. What I do to make sure that I do not get into that situation is make sure that the first line of my file is the %MACRO statement and the last line is the %MEND statement. So there is no place for other code that executes only the first time it is invoked. I also work very hard to make sure that only one macro is defined by one source file. This eliminates the risk of name conflict. Another issue to watch out for is if you are clearing out your compiled code. I think that the MRECALL option needs to be set so that if you had cleared out the compiled version of A3 macro and then call it again that SAS will again %INCLUDE the file to compile the macro. With mutlitple directories you also run the risk of having conflicts in the names of the macros. So if you have macro libraries A1 through A4 then and both A2 and A4 have a macro definition named NOBS whichever is first in the SASAUTOS option will be the one that is used. - Tom Abernathy On Aug 3, 3:55 pm, rahul alawadhi <rahulalawa...(a)gmail.com> wrote: > Hi all > i have some problems coming in using calling autocall library. My > first questions i how many auto call libraries can i call at one > time ...is there any limit to call number of libraries. > > 2nd question is : is there any any order for calling up the autocall > libraries > > filname a1 'c:\macro\a1' > filname a2 'c:\macro\a2' > 'filname a3 'c:\macro\a3' > filname a4 'c:\macro\a4' > > options mautosource sasautos = (a1 a2 a3 a4); > > data xyz; > set xyz; > run; > > %a1 (dsn , a , b); > %a2 (dsn , a , b); > %a3 (dsn , a , b); > %a3 (dsn , a , b); > %a4 (dsn , a , b); > > when i am running my code , the first 2 macros , i am able to invoke > and execute them , problem comes when i am invoking %a3 macro , it is > just invoking itself but not executing , which causes %a4 macro > (neither invocation nor executiion). > > but that macro is complied in Work.Sasmacr . > > But again when i re-run my code in the same session , %a3 macro is > invoked as well as executed. but now %a4 macro is just invoked . and i > can see in work.Sasmacr .... > > i have to again re-run my code to get the complete results . so that > means 3 times i ahve to run the code. > > what all things should i take into account that my codes run fine in > one go. i have also make sure fileaname and macro name should be same. > > can you please help me this situation. > > thanks > > rahul
From: rahul alawadhi on 3 Aug 2010 19:22 On Aug 3, 2:44 pm, Tom Abernathy <tom.aberna...(a)gmail.com> wrote: > Rahul - > > You should not be having trouble where first instance loads, > compiles and runs and the second does nothing. > That sounds as if the code that is being included from the autocall > library is NOT really a macro. So when it is included the first time > it runs just the same as if you did a %INCLUDE on the file. The > second time it runs SAS should find the already compiled macro and so > not bother to include the file again. What I do to make sure that I > do not get into that situation is make sure that the first line of my > file is the %MACRO statement and the last line is the %MEND > statement. So there is no place for other code that executes only the > first time it is invoked. I also work very hard to make sure that > only one macro is defined by one source file. This eliminates the risk > of name conflict. > > Another issue to watch out for is if you are clearing out your > compiled code. I think that the MRECALL option needs to be set so that > if you had cleared out the compiled version of A3 macro and then call > it again that SAS will again %INCLUDE the file to compile the macro. > > With mutlitple directories you also run the risk of having conflicts > in the names of the macros. So if you have macro libraries A1 through > A4 then and both A2 and A4 have a macro definition named NOBS > whichever is first in the SASAUTOS option will be the one that is > used. > > - Tom Abernathy > > On Aug 3, 3:55 pm, rahul alawadhi <rahulalawa...(a)gmail.com> wrote: > > > > > Hi all > > i have some problems coming in using calling autocall library. My > > first questions i how many auto call libraries can i call at one > > time ...is there any limit to call number of libraries. > > > 2nd question is : is there any any order for calling up the autocall > > libraries > > > filname a1 'c:\macro\a1' > > filname a2 'c:\macro\a2' > > 'filname a3 'c:\macro\a3' > > filname a4 'c:\macro\a4' > > > options mautosource sasautos = (a1 a2 a3 a4); > > > data xyz; > > set xyz; > > run; > > > %a1 (dsn , a , b); > > %a2 (dsn , a , b); > > %a3 (dsn , a , b); > > %a3 (dsn , a , b); > > %a4 (dsn , a , b); > > > when i am running my code , the first 2 macros , i am able to invoke > > and execute them , problem comes when i am invoking %a3 macro , it is > > just invoking itself but not executing , which causes %a4 macro > > (neither invocation nor executiion). > > > but that macro is complied in Work.Sasmacr . > > > But again when i re-run my code in the same session , %a3 macro is > > invoked as well as executed. but now %a4 macro is just invoked . and i > > can see in work.Sasmacr .... > > > i have to again re-run my code to get the complete results . so that > > means 3 times i ahve to run the code. > > > what all things should i take into account that my codes run fine in > > one go. i have also make sure fileaname and macro name should be same. > > > can you please help me this situation. > > > thanks > > > rahul- Hide quoted text - > > - Show quoted text - thanks Tom for the help i figured the way out...and thanks for mrecall option... ..
|
Pages: 1 Prev: Error handling for interactive stored processes Next: SAS - proc nlmixed & Cholesky Decomposition |