/** @file @brief Testing ms_webout macro

SAS Macros

@li mf_getuniquefileref.sas @li ms_webout.sas @li mp_assert.sas **/ %let fref=%mf_getuniquefileref(); %global _metaperson; data some datasets; x=1; run; %ms_webout(OPEN,fref=&fref) %ms_webout(ARR,some,fref=&fref) %ms_webout(OBJ,datasets,fref=&fref) %ms_webout(CLOSE,fref=&fref) libname test JSON fileref=&fref; data root; set test.root; call symputx('checkval',sysvlong); run; data alldata; set test.alldata; run; %mp_assert( iftrue=(%str(&checkval)=%str(&sysvlong)), desc=Check if the sysvlong value was created ) /* Test that ms_webout(FETCH) retains leading blanks in character values (simulates the CSV format generated by the sasjs adapter, ie an input statement in the first row followed by unquoted data) */ %let fref2=%mf_getuniquefileref(); data _null_; file &fref2 lrecl=32767 termstr=crlf; put 'col1:$char10. col2:best.'; put ' padded,1'; run; %global _webin_fileref _webin_name; %let _webin_fileref=&fref2; %let _webin_name=leadblank; %let _webin_file_count=1; %ms_webout(FETCH) data _null_; set leadblank; if col1=' padded' then call symputx('checkblank','PASS'); else call symputx('checkblank',cats('FAIL:',col1)); run; %mp_assert( iftrue=(&checkblank=PASS), desc=ms_webout FETCH retains leading blanks with $char informat ) /* same test, but with a plain $ informat (as sent by some clients) */ %let fref3=%mf_getuniquefileref(); data _null_; file &fref3 lrecl=32767 termstr=crlf; put 'col1:$10. col2:best.'; put ' padded,1'; run; %let _webin_fileref=&fref3; %let _webin_name=leadblank2; %let _webin_file_count=1; %ms_webout(FETCH) data _null_; set leadblank2; if col1=' padded' then call symputx('checkblank2','PASS'); else call symputx('checkblank2',cats('FAIL:',col1)); run; %mp_assert( iftrue=(&checkblank2=PASS), desc=ms_webout FETCH retains leading blanks with $ informat )