Are you specifying http Basic authorisation as per the Companies House documentation on authorisation?
I don't use SAS but does the line:
... actually do this? Online documentation for the current version of SAS (9.4) for the PROC http statement doesn't show any additional parameters on the url part but does suggest that you can specify http Basic authorisation using AUTH_BASIC - in which case your API key should go in WEBUSERNAME and WEBPASSWORD would be blank / ignored.
AUTH_BASIC is apparently available from SAS 9.4M3. However if you're using a lower version of SAS you will need to make your own authentication header. The SAS docs say:
specifies a fileref to a text file that contains one line per request header in the format key:value.
Note: Beginning with SAS 9.4M3, this option is supported only for compatibility with previous versions of SAS software. Use the HEADERS Statement instead of HEADERIN=
For how to construct the header see the CH docs and examples on the forum like the one following (see response from csmith):