Re: call random: 372 "R" IN CALL RANDOM MAY NOT BE USED GLOBALLY IN ANOTHER BLOCK.
Pavel,
You must be doing something else that is strange.
What are you using for $SIM?
Here is a working control stream. It doesn't do anything with the random variable but it does run.
$PROB IV and Oral dose
$DATA ivpo20.csv
$INPUT ID TIME AMT CMT DV
$SIM (1234) (5678 UNIFORM) ONLYSIM NSUB=1
$THETA
(0,3,) ; POP_CL
(0,10,) ; POP_VD
(0,1,) ; POP_KA
(0,1,) ; POP_F
$OMEGA
0.09 ; PPV_CL
0.09 ; PPV_V
0.09 ; PPV_KA
0.25 ; PPV_F
$SIGMA
0.01 ; RUV_CV
1 ; RUV_SD
$SUBR ADVAN2 TRANS2
$PK
IF (ICALL.EQ.4) THEN ; only one ICALL.EQ.4 block is needed
IF (NEWIND.NE.2) THEN
CALL RANDOM(2,R)
UNUM=R ; save R value in a new variable
ENDIF
IF (UNUM.LE.0.1855) THEN ; only 1 logical test is required
HM=1
ELSE
HM=0
ENDIF
ENDIF
CL=THETA(1)*EXP(ETA(1))
V=THETA(2)*EXP(ETA(2))
KA=THETA(3)*EXP(ETA(3))
F1=THETA(4)*EXP(ETA(4))
S2=V
$ERROR
Y = F*(1+EPS(1)) + EPS(2)
$TABLE ID TIME CL V KA F1 Y
NOPRINT ONEHEADER FILE=ivpo.fit
Quoted reply history
On 27/03/2014 1:23 p.m., Pavel Belo wrote:
> Thank you Nick.
>
> It does not work. The error message is the same. It is strange. It almost looks like a bag or an installation issue. I tried it on different computers.
>
> On Wed, Mar 26, 2014 at 06:33 PM, Nick Holford wrote:
>
> Pavel,
> The solution is to assign R to another variable. I've also
> re-structured your code to make things clearer (IMHO).
>
> $PK
> IF (ICALL.EQ.4) THEN ; only one ICALL.EQ.4 block is needed
> IF (NEWIND.NE.2) THEN
> CALL RANDOM(2,R)
> UNUM=R ; save R value in a new variable
> ENDIF
> IF (UNUM.LE.0.1855) THEN ; only 1 logical test is required
> HM=1
> ELSE
> HM=0
> ENDIF
> ENDIF
>
> On 27/03/2014 11:23 a.m., Pavel Belo wrote:
> Hello NONMEM73 Users,
> I try to use call random:
> $PK
> IF (ICALL.EQ.4.AND.NEWIND.NE.2) CALL RANDOM(2,R)
> IF (ICALL.EQ.4.AND.R.LE.0.1855) HM=1
> IF (ICALL.EQ.4.AND.R.GT.0.1855) HM=0
> It does not matter how I try to code it, I am receiving the same
> error message:
> 372 "R" IN CALL RANDOM MAY NOT BE USED GLOBALLY IN ANOTHER BLOCK.
> What is wrong with with it?
> Thank you,
> Pavel