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!
Please show the log containing not only the error messages, but the code you used.
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.
COL1. Columns 2-50 are labeled COL1-COL49, respectively.
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
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.