here is one workaround - (there are sure to be others!)
Use a search string on your Patient.NHSNumber field like this
this will strip out the numeric characters and then test the length. So, in theory it will only keep the records having a 10 character numeric value.
in set analysis you will have to write it like this:
The NUM() function you used formats the field it doesn't tell if the field is or isn't a numeric value without additional code.
You could create this condition as a flag on your script:
Load... (your fields, etc) ,
if ( len (Patient.NHSNumber) =10 and isnum( Patient.NHSNumber), 1,0) as patientFlag
Resident/From (as your original code)
Then, in set analysis, your condition will simply be:
Hope this helps,