BookmarkSubscribeRSS Feed
R_A_G_
Calcite | Level 5
Hello Experts,

I have 2 questions regarding Macro:

1) when we assign replication to a set of codes, is there a common problem with these replication going threw the codes differently. Ex: I have 3 replication and the first 2 skips a step while the last one goes threw the whole thing as it supposed to. Is there a common obvious mistake that I should look for

2) when we have a macro within macro with for example 100 iteration. what happens?

do SAS goes threw each macro separately or behaves like a loop, finishing the macro within before ending the macro outside


Thank you for your help
R.A.G.
6 REPLIES 6
Doc_Duke
Rhodochrosite | Level 12
I don't understand question 1. an example would help.

For question 2, by specifying OPTIONS MACROGEN; you can see exactly the code that is generated by a macro (and by a macro within a macro).
R_A_G_
Calcite | Level 5
Thank you Doc,

Maybe this will help, I am getting these errors:

first error:
MPRINT(CREATEMPLUSINPUT): * Item by threshold data for writing item-based commands;
MPRINT(CREATEMPLUSINPUT): DATA itembythresh;
MPRINT(CREATEMPLUSINPUT): SET kernel;
MPRINT(CREATEMPLUSINPUT): RUN;
ERROR: You cannot open WORK.ITEMBYTHRESH.DATA for output access with member-level control
because WORK.ITEMBYTHRESH.DATA is in use by you in resource environment DMS Process.
NOTE: The SAS System stopped processing this step because of errors.

2nd ERROR:
SYMBOLGEN: Macro variable COMMANDFILE resolves to CDM_1
NOTE: Line generated by the invoked macro "WRITEMPLUS".
3 * Name of Mplus file to be written with returns and breaks; FILE
----
180
3 ! "c:\CDM1\&commandfile..inp"; * Mplus TITLE command; PUT @1 "TITLE: ! Section
3 ! that appears in header of output file"; PUT @5
ERROR 180-322: Statement is not valid or it is used out of proper order.
R_A_G_
Calcite | Level 5
Hi Cynthia,

It does relate to the previous issue in a way.

It all comes from the same MACRO but the problems are different.

Thank you
ballardw
Super User
The error: ERROR: You cannot open WORK.ITEMBYTHRESH.DATA for output access with member-level control
because WORK.ITEMBYTHRESH.DATA is in use by you in resource environment DMS Process.

means that some other program has the output data set open and/or locked so the referenced data step can't use it. It is likely you opened the data set to see the results previously and didn't close it from the table view.
R_A_G_
Calcite | Level 5
Thank you
that make sense and I am sure you are right. B/C when I have 1 iteration it works fine the problem starts when I have more than 1 iteration which from what you've said means the first iteration opens it and does not close it. How do I close these three files. I have tried the following and still does not work:

%let ITEMBYTHRESH=%sysfunc(close(&.ITEMBYTHRESH));
I have 3 of these files with different names

Thank you
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3713 views
  • 0 likes
  • 4 in conversation