New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
phdibart
Fluorite | Level 6

I'm trying to run a spatial regression with PROC SPATIALREG with a SPATIALID statement, but I keep getting the following error.

ERROR: The column 2 of data set WORK.A does not have a valid column name.

 

Dataset A to which the error refers is a 49x50 spatial weight matrix for 49 states with a spatial ID for each state as the first variable.  The ID variable name is state_num in column 1, and all subsequent columns are labeled COL1...COL49.

 

Any help is appreciated!

7 REPLIES 7
mkeintz
PROC Star

Please show the log containing not only the error messages, but the code you used.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
phdibart
Fluorite | Level 6

My apologies.  Here it is.

513 proc spatialreg
514 data = f wmat = a nonormalize;
515 model propa_bla = prop_bla aff_general aff_bla avgdma /type = sar;
516 spatialid state_num;
517 quit;

ERROR: The column 2 of data set WORK.A does not have a valid column name.
ERROR: This model cannot be fit.
Reeza
Super User
ERROR: The column 2 of data set WORK.A does not have a valid column name.
What's the column name of the second column in the data set A?
phdibart
Fluorite | Level 6

COL1.  Columns 2-50 are labeled COL1-COL49, respectively.

Reeza
Super User
And the values in the first column are then called COL1-COL49 for alignment?
Reeza
Super User

They need to match per the documentation. So if you're using StateNumbers as Column1 the weights need to align so the matrix shows how State1 maps to State5 and it doesn't know that Column5 is actually State5 if the names are not identical.

 

Page 2377 here

https://support.sas.com/documentation/onlinedoc/ets/142/spatialreg.pdf

phdibart
Fluorite | Level 6

I completely missed that when I looked through that document earlier.  So I either need to rename the columns to match the state numbers or rename the state numbers to match COL1-COL49.  I'm going to try that now.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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