Skip to content

Commit

Permalink
fix: numeric precision
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan Bowe committed Mar 27, 2020
1 parent 88d9a6a commit e109bb4
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 24 deletions.
48 changes: 36 additions & 12 deletions mc_all.sas
Original file line number Diff line number Diff line change
Expand Up @@ -4638,7 +4638,7 @@ data _null_;
put ' infile &&_webin_fileref&i firstobs=2 dsd termstr=crlf encoding=''utf-8''; ';
put ' input &input_statement; ';
put ' %if &_debug ge 131 %then %do; ';
put ' putlog _infile_; ';
put ' if _n_<20 then putlog _infile_; ';
put ' %end; ';
put ' run; ';
put ' %end; ';
Expand All @@ -4661,12 +4661,15 @@ data _null_;
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
put ' ';
put ' %if &sysver=9.4 %then %do; ';
put ' /* yay - we have proc json */ ';
put ' data;run;%let tempds=&syslast; ';
put ' proc sql;drop table &tempds; ';
put ' data &tempds /view=&tempds;set &ds; format _numeric_ best32.; ';
put ' proc json out=&fref ';
put ' %if &action=ARR %then nokeys ; ';
put ' %if &_debug ge 131 %then pretty ; ';
put ' ;export &ds / nosastags; ';
put ' ;export &tempds / nosastags; ';
put ' run; ';
put ' proc sql;drop view &tempds; ';
put ' %end; ';
put ' %else %do; ';
put ' /* time to get our hands dirty */ ';
Expand Down Expand Up @@ -7327,7 +7330,7 @@ run;
infile &&_webin_fileref&i firstobs=2 dsd termstr=crlf encoding='utf-8';
input &input_statement;
%if &_debug ge 131 %then %do;
putlog _infile_;
if _n_<20 then putlog _infile_;
%end;
run;
%end;
Expand All @@ -7350,12 +7353,15 @@ run;
put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":";

%if &sysver=9.4 %then %do;
/* yay - we have proc json */
data;run;%let tempds=&syslast;
proc sql;drop table &tempds;
data &tempds /view=&tempds;set &ds; format _numeric_ best32.;
proc json out=&fref
%if &action=ARR %then nokeys ;
%if &_debug ge 131 %then pretty ;
;export &ds / nosastags;
;export &tempds / nosastags;
run;
proc sql;drop view &tempds;
%end;
%else %do;
/* time to get our hands dirty */
Expand Down Expand Up @@ -7916,7 +7922,13 @@ data _null_;
put ' infile indata termstr=crlf ; ';
put ' input; ';
put ' if _n_=1 then call symputx(''input_statement'',_infile_); ';
put ' list; ';
put ' %if &_debug ge 131 %then %do; ';
put ' if _n_<20 then putlog _infile_; ';
put ' else stop; ';
put ' %end; ';
put ' %else %do; ';
put ' stop; ';
put ' %end; ';
put ' run; ';
put ' data &&_webin_name&i; ';
put ' infile indata firstobs=2 dsd termstr=crlf ; ';
Expand Down Expand Up @@ -7945,12 +7957,15 @@ data _null_;
put ' options validvarname=upcase; ';
put ' data _null_;file &fref mod; ';
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
put ' ';
put ' data;run;%let tempds=&syslast; ';
put ' proc sql;drop table &tempds; ';
put ' data &tempds /view=&tempds;set &ds; format _numeric_ best32.; ';
put ' proc json out=&fref ';
put ' %if &action=ARR %then nokeys ; ';
put ' %if &_debug ge 131 %then pretty ; ';
put ' ;export &ds / nosastags; ';
put ' ;export &tempds / nosastags fmtnumeric; ';
put ' run; ';
put ' proc sql;drop view &tempds; ';
put '%end; ';
put '%else %if &action=CLOSE %then %do; ';
put ' %if &_debug ge 131 %then %do; ';
Expand Down Expand Up @@ -9042,7 +9057,13 @@ filename &fref2 clear;
infile indata termstr=crlf ;
input;
if _n_=1 then call symputx('input_statement',_infile_);
list;
%if &_debug ge 131 %then %do;
if _n_<20 then putlog _infile_;
else stop;
%end;
%else %do;
stop;
%end;
run;
data &&_webin_name&i;
infile indata firstobs=2 dsd termstr=crlf ;
Expand Down Expand Up @@ -9071,12 +9092,15 @@ filename &fref2 clear;
options validvarname=upcase;
data _null_;file &fref mod;
put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":";

data;run;%let tempds=&syslast;
proc sql;drop table &tempds;
data &tempds /view=&tempds;set &ds; format _numeric_ best32.;
proc json out=&fref
%if &action=ARR %then nokeys ;
%if &_debug ge 131 %then pretty ;
;export &ds / nosastags;
;export &tempds / nosastags fmtnumeric;
run;
proc sql;drop view &tempds;
%end;
%else %if &action=CLOSE %then %do;
%if &_debug ge 131 %then %do;
Expand Down
9 changes: 6 additions & 3 deletions meta/mm_createwebservice.sas
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ data _null_;
put ' infile &&_webin_fileref&i firstobs=2 dsd termstr=crlf encoding=''utf-8''; ';
put ' input &input_statement; ';
put ' %if &_debug ge 131 %then %do; ';
put ' putlog _infile_; ';
put ' if _n_<20 then putlog _infile_; ';
put ' %end; ';
put ' run; ';
put ' %end; ';
Expand All @@ -136,12 +136,15 @@ data _null_;
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
put ' ';
put ' %if &sysver=9.4 %then %do; ';
put ' /* yay - we have proc json */ ';
put ' data;run;%let tempds=&syslast; ';
put ' proc sql;drop table &tempds; ';
put ' data &tempds /view=&tempds;set &ds; format _numeric_ best32.; ';
put ' proc json out=&fref ';
put ' %if &action=ARR %then nokeys ; ';
put ' %if &_debug ge 131 %then pretty ; ';
put ' ;export &ds / nosastags; ';
put ' ;export &tempds / nosastags; ';
put ' run; ';
put ' proc sql;drop view &tempds; ';
put ' %end; ';
put ' %else %do; ';
put ' /* time to get our hands dirty */ ';
Expand Down
9 changes: 6 additions & 3 deletions meta/mm_webout.sas
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
infile &&_webin_fileref&i firstobs=2 dsd termstr=crlf encoding='utf-8';
input &input_statement;
%if &_debug ge 131 %then %do;
putlog _infile_;
if _n_<20 then putlog _infile_;
%end;
run;
%end;
Expand All @@ -79,12 +79,15 @@
put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":";

%if &sysver=9.4 %then %do;
/* yay - we have proc json */
data;run;%let tempds=&syslast;
proc sql;drop table &tempds;
data &tempds /view=&tempds;set &ds; format _numeric_ best32.;
proc json out=&fref
%if &action=ARR %then nokeys ;
%if &_debug ge 131 %then pretty ;
;export &ds / nosastags;
;export &tempds / nosastags;
run;
proc sql;drop view &tempds;
%end;
%else %do;
/* time to get our hands dirty */
Expand Down
15 changes: 12 additions & 3 deletions viya/mv_createwebservice.sas
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,13 @@ data _null_;
put ' infile indata termstr=crlf ; ';
put ' input; ';
put ' if _n_=1 then call symputx(''input_statement'',_infile_); ';
put ' list; ';
put ' %if &_debug ge 131 %then %do; ';
put ' if _n_<20 then putlog _infile_; ';
put ' else stop; ';
put ' %end; ';
put ' %else %do; ';
put ' stop; ';
put ' %end; ';
put ' run; ';
put ' data &&_webin_name&i; ';
put ' infile indata firstobs=2 dsd termstr=crlf ; ';
Expand Down Expand Up @@ -296,12 +302,15 @@ data _null_;
put ' options validvarname=upcase; ';
put ' data _null_;file &fref mod; ';
put ' put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":"; ';
put ' ';
put ' data;run;%let tempds=&syslast; ';
put ' proc sql;drop table &tempds; ';
put ' data &tempds /view=&tempds;set &ds; format _numeric_ best32.; ';
put ' proc json out=&fref ';
put ' %if &action=ARR %then nokeys ; ';
put ' %if &_debug ge 131 %then pretty ; ';
put ' ;export &ds / nosastags; ';
put ' ;export &tempds / nosastags fmtnumeric; ';
put ' run; ';
put ' proc sql;drop view &tempds; ';
put '%end; ';
put '%else %if &action=CLOSE %then %do; ';
put ' %if &_debug ge 131 %then %do; ';
Expand Down
15 changes: 12 additions & 3 deletions viya/mv_webout.sas
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@
infile indata termstr=crlf ;
input;
if _n_=1 then call symputx('input_statement',_infile_);
list;
%if &_debug ge 131 %then %do;
if _n_<20 then putlog _infile_;
else stop;
%end;
%else %do;
stop;
%end;
run;
data &&_webin_name&i;
infile indata firstobs=2 dsd termstr=crlf ;
Expand Down Expand Up @@ -141,12 +147,15 @@
options validvarname=upcase;
data _null_;file &fref mod;
put ", ""%lowcase(%sysfunc(coalescec(&dslabel,&ds)))"":";

data;run;%let tempds=&syslast;
proc sql;drop table &tempds;
data &tempds /view=&tempds;set &ds; format _numeric_ best32.;
proc json out=&fref
%if &action=ARR %then nokeys ;
%if &_debug ge 131 %then pretty ;
;export &ds / nosastags;
;export &tempds / nosastags fmtnumeric;
run;
proc sql;drop view &tempds;
%end;
%else %if &action=CLOSE %then %do;
%if &_debug ge 131 %then %do;
Expand Down

0 comments on commit e109bb4

Please sign in to comment.