BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
_Hopper
Quartz | Level 8

When using PROC MI I was provided some code but it does not work. In my dataset I have three treatment values (1 2 3).

There are two MNAR calls in the code, one is for TRT  = 3 and the other is for TRT 1 and 2 combined. PROC MI says the following code is not allowed because a symbol other an equal "=" isn't allowed. Any thoughts on how to make this work are appreciated.

 

proc mi data=&data seed=123 nimpute=100 out=outmi;
class trtpn;
fcs reg;
mnar adjust (m12/shift=&k1 adjustobs=(trtpn^=3));<<<<<<<<<<<<<<<<<<<<<<-this line causes an error
mnar adjust (m12/shift=&k2 adjustobs=(trtpn=3));
var m3 m6 m12 m24 m36 ;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

Yes, alternatively, you can use a list inside the parenthesis.  This approach in your case might be easier so I would recommend that.

mnar adjust (m12/shift=&k1 adjustobs=(treatnp='1' '2'));

View solution in original post

7 REPLIES 7
sbxkoenk
SAS Super FREQ

I think @SAS_Rob can help you out.

(he's being notified due to me @-mentioning him here)

SAS_Rob
SAS Employee

MI will only allow you to use an = sign in adjustobs= option. 

My suggestion would be to create a new variable that only has two levels to it, the combined 1,2 and 3 using a data step by defining it something like this:

trtpn_new=(trtpn ne 3);

 

Then use that variable in the Proc MI step.

proc mi data=&data seed=123 nimpute=100 out=outmi;
class trtpn_new;
fcs reg;
mnar adjust (m12/shift=&k1 adjustobs=(trtpn_new=1));
mnar adjust (m12/shift=&k2 adjustobs=(trtpn_new=0));
var m3 m6 m12 m24 m36 ;
run;

_Hopper
Quartz | Level 8

Rob,

 

Thanks for the suggestion. Would something like this work as an alternative:

 

mnar adjust (m12/shift=&k1 adjustobs=(treatnp='1' '2'));
mnar adjust (m12/shift=&k2 adjustobs=(treatnp='3'));

 

I'm fine using your solution as well.

SAS_Rob
SAS Employee

Yes, alternatively, you can use a list inside the parenthesis.  This approach in your case might be easier so I would recommend that.

mnar adjust (m12/shift=&k1 adjustobs=(treatnp='1' '2'));

_Hopper
Quartz | Level 8

Rob - thanks. One other item isn't quite working for me.

 

Let's say my change mean for treatment groups= -100

Let's say my control change mean = -200

I set S1 = -100 and S2 = -200 then my increment is +15 if I want 20 equal intervals. Is this correct?

The MI output doesn't look right - the shift values appear to be going the wrong way as the model iterates. Any thoughts? 

 

 

SAS_Rob
SAS Employee
Can you post the most recent code along with the output that shows what you are seeing?
_Hopper
Quartz | Level 8

Rob,

 

As it turns out the model code I was given contained an error, so that S2 was not properly computed. Once I corrected it, the code ran as expected.

 

Thanks for your help!

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 894 views
  • 0 likes
  • 3 in conversation