Write and run SAS programs in your web browser

Variable not found

Regular Contributor
Posts: 184

Variable not found

[ Edited ]



New SAS user here. I am trying to add a variable "FERTILITY_TEEN" to my multivariate regression model. However, while the datasets have been properly merged and I can even run proc means on this variable, SAS won't recognize the variable when I try to run the regression. Do you have any idea why SAS wouldn't recognize the name of the variable in the proc reg statement? I find it particularly strange given that it read it in the proc means statement. I've attached some screenshots for reference. 


Thanks so much,



Super User
Posts: 13,023

Re: Variable not found

Most likely cause: spelling the name differently than it occurs in the data set. Second is it isn't there at all.


Post code and log into code box opened using the forum {I} menu icon.

Many people don't want to take the chance on reading DOCX or XLSX files from an unknown source. Others just don't want to bother with the way the forum is currently handling some attachments. Reading the code in a code box is just plain easier as you can copy from the log or the SAS editor and paste directly into the code box and maintain the format of the text.

Super User
Super User
Posts: 7,847

Re: Variable not found

[ Edited ]

No need to make a word file so you can post a photograph of your screen. Just use the Photos icon on the editor tool bar.

But to get an answer you need to post the code you ran.  To post the code or log copy it as text (don't take a picture of it!) and paste it into the pop-up window that the Insert Code or Insert SAS Code buttons on the tool bar open.


You are either trying to reference the variable by its label instead of its name or you ran the regression on a different dataset than the one used for proc means.

Ask a Question
Discussion stats
  • 2 replies
  • 1 like
  • 3 in conversation