generating unique id field for OLS regression

4731
3
02-20-2012 09:36 AM
grahamlangley-edwards
New Contributor II
Hi, I am trying to generate a unique id field, in ArcGIS 10, in order to run an OLS regression.  I created a new unique id field in the attribute table of the point shape file.  I then tried to generate values for it using the field calculator and the FID field (UniqueID = FID), the FID field has different values for each row.  The process begins, but half way through I get this error - " The calculated value is invalid for the row with object ID = 32768.  For example, the calculated value may be too large for the field or you may be trying to add a string to a number field.  This row will not be updated."
When I look at the unique id field after the process has run, the values go up to 9999 and then begin again at 1000.  Apparently, the field calculator is not "seeing" the entire number in the cells with more than 4 numbers, and assigns only the first 4 number in the FID field to the Unique ID field. Then at entry 32768, it begins assigning values of 0 to the Unique ID field.  There are 41,643 entries.  I tried using other fields that also have different values for each row to generate the Unique ID field, but the same problem happens.  I don't see how the calculated value could be too large for the field, and I am not trying to add a string to a number field.  I also cannot delete any of the Unique ID fields that I created in the attribute table, I tried right-clicking on the field and clicking delete to no avail.  Any help would be greatly appreciated.

Thanks
0 Kudos
3 Replies
grahamlangley-edwards
New Contributor II
Ok, so I figured out that I just needed to create another Unique ID field and set the Precision field to 5 or greater because I only have 41,643 entries.  The default is set to 4.   However, when I try to run the OLS regression the new Unique ID field with the correct values is not listed as an option!  I still cannot delete the other Unique ID fields either.  Please help.

Thanks
0 Kudos
DavidBirkigt
New Contributor III
Hi,

I think I understand what your problem is and I think it is the result of data types. When you added your new field there is an option to set type. The type you set it to dictates what type of number can be stored, decimals, text, big numbers etc.

You said the error occurred on record 32768, if you look at the info I added below you will see a short integer only stores numbers as big as 32767, ie it can not hold bigger numbers. What you should try is adding that row again setting it to long (as fid does not have any decimals).

Take a look at the other info below on the other data types and scale/precision.

Also, there are a million other programs you can do an ols in, R, EXCEL ...

Let me know how things go.


Short integer uses 16 bits to store, number range from -32768 to 32767, no decimals

Long integer uses 32 bits number range -2,147,483,648 to 2,147,483,647, no decimals

Float 3.4E38 to 1.2E38, ie can hold big positive numbers with decimals

Double -2.2E308 to 1.8E308 ie can hold big positive and negative numbers with decimal

If you pick float or double these two have additional properties you can set for rounding
purposes (scale and precision)

Precision: The total number of digits ie 123456789 has a precision of 9

So does 123.45678 the decimal requires one storage place

Scale: Is essentially the number of decimals, ie the above has a scale of 5

*** Be aware in all other applications of math precision is essentially the number of decimals (just to
make things more confusing)
0 Kudos
grahamlangley-edwards
New Contributor II
Yes, that was it exactly.  Thank you for your help!!!  I really appreciate it.

Regards,

Graham
0 Kudos