Hi Chris 🙂
I'm running Windows 7 32-bit with SAS 9.4 TS1M3 locally installed.
I'm trying multiple versions of the PROC DS2 HTTP / JSON packages and getting errors that I don't understand. When I run your example (straight copy / paste from the article) I get "getNextToken encountered a failure", "Encountered an illegal character", "JSON Parser located at column 0 of line 1 within the text".
I've tried other HTTP / JSON examples and get different errors, probably because of the different ways to use the packages. In one case, I'm running the code below and getting "DATA STEP component object failure. Aborted during compilation phase. Statement is not valid or it is used out of proper order." and then " PACKAGE is not a known class name".
data _null_;
method init();
dcl package json j();
dcl int rc tokenType parseFlags;
dcl bigint lineNum colNum;
dcl nvarchar(128) token abc t1;
abc = 'xyz';
t1 = '{"abc" : 1 }';
rc = j.createParser( t1 );
if (rc ne 0) then goto TestError;
* obj open;
j.getNextToken( rc, token, tokenType, parseFlags, lineNum, colNum );
if ( rc ne 0 ) then goto TestError;
* obj label;
j.getNextToken( rc, token, tokenType, parseFlags, lineNum, colNum );
if ( rc ne 0 ) then goto TestError;
* obj value;
j.getNextToken( rc, token, tokenType, parseFlags, lineNum, colNum );
if ( rc ne 0) then goto TestError;
* obj close;
j.getNextToken( rc, token, tokenType, parseFlags, lineNum, colNum );
if ( rc ne 0 ) then goto TestError;
Exit:
rc = j.destroyParser();
return;
TestError:
put 'Test ended abnormally.';
goto Exit;
end;
enddata;
run;
Any thoughts? I've started fiddling around with this and so probably missing something.
Thanks and don't work too hard!
Chris
... View more