BookmarkSubscribeRSS Feed
K_Wils15
Obsidian | Level 7

Here is what I am trying to solve for:

Using the data set HW4D1, fit a log-linear negative-binomial regression modeling the number of home runs a player hit in the 1986 season (i.e. variable nhome), with the explanatory variable salary.  

Here is my code:

PROC IMPORT OUT= WORK.BASEBALL
DATAFILE= "C:\Users\kpwil\Downloads\HW4D1 (4).xlsx"
DBMS=EXCEL REPLACE;
RANGE="'HW4D1 (4)$'";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
proc print data= Baseball;
run;

proc logistic data=baseball desc;
model y = nHome ;
run;

 

 

The output has an error: ERROR: VARIABLE Y NOT FOUND

 

It reads the data because I did a proc print and it came out fine, what should I do? 

2 REPLIES 2
CurtisMackWSIPP
Lapis Lazuli | Level 10

Is the variable really named "Y"?

K_Wils15
Obsidian | Level 7

no thanks, that is where I was incorrect there because I took the code from an example and I thought y was used as part of an equation. I actually needed to use proc genmod too. 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 2 replies
  • 833 views
  • 2 likes
  • 2 in conversation