BookmarkSubscribeRSS Feed
mahdiamah
Fluorite | Level 6

Hi 

I have run proc nlmixed to run "marginalized
random-effects model" and faced to this error:

"ERROR: Dependent variable is not in the input data set"

I checked my data and variables. But i could not find out what is the problem.

SAS does not accept my Dependent variable or any other kind of variable as Dependent variable!

I tried on my variables in different models and i could take response. 

Is there any one to help me?

Thanks

10 REPLIES 10
ballardw
Super User

When you get an error it is best to copy from the log the procedure code and any messages from the log and paste the copied text into a code box opened on the forum with the {I} icon. The code box is important to preserve formatting of error messages and the main message windows on this forum will reformat text.

 

Check your MODEL statement. The first thing after model should be a variable in the data. You may have a subtle type like Var0 instead of VarO  (zero vs capital O) or similar.

Astounding
PROC Star

Also check the name of the data set you are using.  Perhaps you added the dependent to a new data set, but the PROC still uses the old data set.

mahdiamah
Fluorite | Level 6
Dear ballardw and Astounding
Thank you for your attentions.
I opened and copied all variables from my data to the model. The data set is correct too.I even tried for other responses. But the error is still the same.
{NOTE: The parameter repeat is assigned the default starting value of 1.0, because it is not
assigned an initial value with the PARMS statement.
WARNING: Parameter group_a is in the input data set.
WARNING: Parameter Time_num is in the input data set.
WARNING: Parameter group_b is in the input data set.
WARNING: Parameter Time_num is in the input data set.
ERROR: Dependent variable is not in the input data set.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE NLMIXED used (Total process time):
real time 0.05 seconds
cpu time 0.04 seconds
}

PaigeMiller
Diamond | Level 26

Repeating what @ballardw said

 

"copy from the log the procedure code and any messages from the log and paste the copied text into a code box opened on the forum with the {I} icon."

 

we need to see the CODE you used (as shown in the log) and the ERROR messages in the log, in other words the entire log for this PROC, pasted into the {i} window.

 

We probably also need to see the PROC CONTENTS output of the data set you are using for this NLMIXED. (Copy and paste into a new {i} window)

--
Paige Miller
mahdiamah
Fluorite | Level 6

Dear 

I sent all procedure in the last post. 

Please let me know if you have any idea to solve this error.

regards,

 

ballardw
Super User

@mahdiamah wrote:
Dear ballardw and Astounding
Thank you for your attentions.
I opened and copied all variables from my data to the model. The data set is correct too.I even tried for other responses. But the error is still the same.
{NOTE: The parameter repeat is assigned the default starting value of 1.0, because it is not
assigned an initial value with the PARMS statement.
WARNING: Parameter group_a is in the input data set.
WARNING: Parameter Time_num is in the input data set.
WARNING: Parameter group_b is in the input data set.
WARNING: Parameter Time_num is in the input data set.
ERROR: Dependent variable is not in the input data set.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE NLMIXED used (Total process time):
real time 0.05 seconds
cpu time 0.04 seconds
}


Here is an example of what I mean by "copy from the log" and paste into code box opened with the {I}

908  proc nlmixed data=work.theoph;
909     parms beta1=-3.22 beta2=0.47 beta3=-2.45
910           s2b1 =0.03  cb12 =0    s2b2 =0.4 s2=0.5;
911     cl   = exp(beta1 + b1);
912     ka   = exp(beta2 + b2);
913     ke   = exp(beta3);
914     pred = dose*ke*ka*(exp(-ke*time)-exp(-ka*time))/cl/(ka-ke);
915     model conc ~ normal(pred,s2);
916     random b1 b2 ~ normal([0,0],[s2b1,cb12,s2b2]) subject=subject;
917  run;

ERROR: QUANEW Optimization cannot be completed.
NOTE: Optimization routine cannot improve the function value.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE NLMIXED used (Total process time):
      real time           2.38 seconds
      cpu time            2.00 seconds

This Error is likely because the example data set used is limited in content. Put please notice that the entire procedure is present from the Proc to the Run statement. That way it is easy to see every single option used.

 

If I change the spelling of the variable on the Model statement:

918  proc nlmixed data=work.theoph;
919     parms beta1=-3.22 beta2=0.47 beta3=-2.45
920           s2b1 =0.03  cb12 =0    s2b2 =0.4 s2=0.5;
921     cl   = exp(beta1 + b1);
922     ka   = exp(beta2 + b2);
923     ke   = exp(beta3);
924     pred = dose*ke*ka*(exp(-ke*time)-exp(-ka*time))/cl/(ka-ke);
925     model conco ~ normal(pred,s2);
926     random b1 b2 ~ normal([0,0],[s2b1,cb12,s2b2]) subject=subject;
927  run;

ERROR: Dependent variable is not in the input data set.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE NLMIXED used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds

Which shows the exact same error you claim to be getting. I know the set used in my example Nlmixed code does not have a variable named Conco so the error is not unexpected. This is why I strongly suspect either you have a typo for the variable on the model statement or possibly are using an incorrect data set.

 

If I run Proc Contents on the dataset used in the Proc Nlmixed data= such as

proc contents data=work.theoph;
run;

Part of the output looks like:

Alphabetic List of Variables and Attributes

#    Variable    Type    Len

3    conc        Num       8
4    dose        Num       8
1    subject     Num       8
2    time        Num       8
5    wt          Num       8


Where in my case it is very easy to see that the variable name is not conco.

Which is why @PaigeMiller suggesting showing us the result of Proc contents on the data set used in Proc Nlmixed along with the code with messages from the log.

 

mahdiamah
Fluorite | Level 6

Dear 

Thank you for your response.

 

{proc nlmixed data=new qpoints=50 maxiter=1000;
parms a1=-1.35 a2=-0.74 Time_a=-0.02 group_a=0.09 cs_a=0.97 LAS_a=-0.29
           b1=-6.67 b2=-2.58 Time_b=-0.03 group_b=0.76 cs_b=0.21 LAS_b=0.03
           s1=0.35 s2=0.5 s12=0.1;
*y1 = HH;
if j in (1,2,3,4,5,6,7)then do;
eta1 = group_a*Time_a + cs_a*cs_a + LAS_a*LAS_a;
delta11= sqrt(1+s1**2) * PROBIT( exp(a1+eta1)/(1+exp(a1+eta1)));
delta12= sqrt(1+s1**2) * PROBIT( exp(a2+eta1)/(1+exp(a2+eta1)));
if ordinal=1 then do;
lik= probnorm (delta11+u1);
end;
if ordinal=2 then do;
lik= 1- probnorm (delta12+u1);
end;
if (lik > 1e-10) then loglik = log(lik);
else loglik = 1e100;
end;
*y2 = LL;
if j in (1,2,3,4,5,6,7)then do;
eta2 = group_b*Time_b + cs_b*cs_b + LAS_b*LAS_b;
delta21 = sqrt(1+s2**2) * PROBIT( exp(b1+eta2)/(1+exp(b1+eta2)));
delta22 = sqrt(1+s2**2) * PROBIT( exp(b2+eta2)/(1+exp(b2+eta2)));
if ordinal=1 then do;
lik = PROBNORM(delta21+u2);
end;
if ordinal=1 then do;
lik= 1- probnorm (delta22+u2);
end;
if (lik > 1e-10) then loglik = log(lik);
else loglik = 1e100;
end;
model ordinal ~ general(loglik);
random u1 u2 ~ normal ([0,0] , [s1**2,s12,s2**2]) subject=id;
estimate "Rho" s12/(s1*s2);
run;}

 

 

{NOTE: The parameter j is assigned the default starting value of 1.0, because it is not
assigned an initial value with the PARMS statement.
WARNING: Parameter Time_a is in the input data set.
WARNING: Parameter group_a is in the input data set.
WARNING: Parameter cs_a is in the input data set.
WARNING: Parameter LAS_a is in the input data set.
WARNING: Parameter Time_b is in the input data set.
WARNING: Parameter group_b is in the input data set.
WARNING: Parameter cs_b is in the input data set.
WARNING: Parameter LAS_b is in the input data set.
ERROR: Dependent variable is not in the input data set.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE NLMIXED used (Total process time):
real time 1.10 seconds
cpu time 0.12 seconds}

 

Alphabetic List of Variables and Attributes# Variable Type Len Format Label9238101145671
HHNum8HH.HH
LAS_aNum8F12.LAS_a
LAS_bNum8F8.2LAS_b
LLNum8LL.LL
Time_aNum8F8.2Time_a
Time_bNum8F8.2Time_b
cs_aNum8F12.cs_a
cs_bNum8F8.2cs_b
group_aNum8GROUP_AA.group_a
group_bNum8GROUP_BA.group_b
idNum8F8.2id

 

I look forward to your reply

Thanks

ballardw
Super User

@mahdiamah wrote:

Dear 

Thank you for your response.

 

{proc nlmixed data=new qpoints=50 maxiter=1000;
parms a1=-1.35 a2=-0.74 Time_a=-0.02 group_a=0.09 cs_a=0.97 LAS_a=-0.29
           b1=-6.67 b2=-2.58 Time_b=-0.03 group_b=0.76 cs_b=0.21 LAS_b=0.03
           s1=0.35 s2=0.5 s12=0.1;
*y1 = HH;
if j in (1,2,3,4,5,6,7)then do;
eta1 = group_a*Time_a + cs_a*cs_a + LAS_a*LAS_a;
delta11= sqrt(1+s1**2) * PROBIT( exp(a1+eta1)/(1+exp(a1+eta1)));
delta12= sqrt(1+s1**2) * PROBIT( exp(a2+eta1)/(1+exp(a2+eta1)));
if ordinal=1 then do;
lik= probnorm (delta11+u1);
end;
if ordinal=2 then do;
lik= 1- probnorm (delta12+u1);
end;
if (lik > 1e-10) then loglik = log(lik);
else loglik = 1e100;
end;
*y2 = LL;
if j in (1,2,3,4,5,6,7)then do;
eta2 = group_b*Time_b + cs_b*cs_b + LAS_b*LAS_b;
delta21 = sqrt(1+s2**2) * PROBIT( exp(b1+eta2)/(1+exp(b1+eta2)));
delta22 = sqrt(1+s2**2) * PROBIT( exp(b2+eta2)/(1+exp(b2+eta2)));
if ordinal=1 then do;
lik = PROBNORM(delta21+u2);
end;
if ordinal=1 then do;
lik= 1- probnorm (delta22+u2);
end;
if (lik > 1e-10) then loglik = log(lik);
else loglik = 1e100;
end;
model ordinal ~ general(loglik);
random u1 u2 ~ normal ([0,0] , [s1**2,s12,s2**2]) subject=id;
estimate "Rho" s12/(s1*s2);
run;}

 

 

{NOTE: The parameter j is assigned the default starting value of 1.0, because it is not
assigned an initial value with the PARMS statement.
WARNING: Parameter Time_a is in the input data set.
WARNING: Parameter group_a is in the input data set.
WARNING: Parameter cs_a is in the input data set.
WARNING: Parameter LAS_a is in the input data set.
WARNING: Parameter Time_b is in the input data set.
WARNING: Parameter group_b is in the input data set.
WARNING: Parameter cs_b is in the input data set.
WARNING: Parameter LAS_b is in the input data set.
ERROR: Dependent variable is not in the input data set.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE NLMIXED used (Total process time):
real time 1.10 seconds
cpu time 0.12 seconds}

 

Alphabetic List of Variables and Attributes# Variable Type Len Format Label9238101145671
HH Num 8 HH. HH
LAS_a Num 8 F12. LAS_a
LAS_b Num 8 F8.2 LAS_b
LL Num 8 LL. LL
Time_a Num 8 F8.2 Time_a
Time_b Num 8 F8.2 Time_b
cs_a Num 8 F12. cs_a
cs_b Num 8 F8.2 cs_b
group_a Num 8 GROUP_AA. group_a
group_b Num 8 GROUP_BA. group_b
id Num 8 F8.2 id

 

I look forward to your reply

Thanks


Ordinal as used in the MODEL statement must be a variable in the data set.

The Proc Contents does not show a variable Ordinal. Hence the error message.

 

Extracted from the Nlmixed Model statement documentation:

You must specify a single dependent variable from the input data set, a tilde ~, and then a distribution with its parameters.

my emphasis added.

 

mahdiamah
Fluorite | Level 6

Dear 

 

ballardw
Super User

@mahdiamah wrote:

Dear 

 


Typically the SAS modeling procedures have a value you supply as a dependent variable along with independent variables and you are attempting to fit parameters with those independent variables that give you the "best" approach to approximating the dependent values.

 

So if you don't have any actual dependent value what are you modeling??? There isn't a question of "change variable type" as you haven't identified any variable that may need to change type (I don't think that is needed). I would expect a variable on the Model statement to possibly indicate the number of successful trials of attempts, or a measurement value under different conditions or some similar "result".

 

 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 10 replies
  • 3250 views
  • 2 likes
  • 4 in conversation