mirror of
https://github.com/sasjs/core.git
synced 2025-12-10 22:14:35 +00:00
fix: support for SUB (1A) hex char in DATASTEP generated JSON. Closes #307
This commit is contained in:
60
all.sas
60
all.sas
@@ -8903,7 +8903,7 @@ options
|
||||
call symputx(cats('label',_n_),coalescec(label,name),'l');
|
||||
/* overwritten when fmt=Y and a custom format exists in catalog */
|
||||
if typelong='num' then call symputx(cats('fmtlen',_n_),200,'l');
|
||||
else call symputx(cats('fmtlen',_n_),min(32767,ceil((length+3)*1.5)),'l');
|
||||
else call symputx(cats('fmtlen',_n_),min(32767,ceil((length+10)*1.5)),'l');
|
||||
run;
|
||||
|
||||
%let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32);
|
||||
@@ -8959,8 +8959,8 @@ options
|
||||
%let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32);
|
||||
proc sql noprint;
|
||||
create table &tmpds1 as
|
||||
select cats(libname,'.',memname) as fmtcat,
|
||||
fmtname
|
||||
select cats(libname,'.',memname) as FMTCAT,
|
||||
FMTNAME
|
||||
from dictionary.formats
|
||||
where fmttype='F' and libname is not null
|
||||
and fmtname in (select format from &colinfo where format is not null)
|
||||
@@ -8985,7 +8985,7 @@ options
|
||||
|
||||
proc sql;
|
||||
create table &tmpds4 as
|
||||
select a.*, b.length as maxw
|
||||
select a.*, b.length as MAXW
|
||||
from &colinfo a
|
||||
left join &tmpds2 b
|
||||
on cats(a.format)=cats(upcase(b.fmtname))
|
||||
@@ -8996,7 +8996,7 @@ options
|
||||
call symputx(
|
||||
cats('fmtlen',_n_),
|
||||
/* vars need extra padding due to JSON escaping of special chars */
|
||||
min(32767,ceil((max(length,maxw)+3)*1.5))
|
||||
min(32767,ceil((max(length,maxw)+10)*1.5))
|
||||
,'l'
|
||||
);
|
||||
run;
|
||||
@@ -9071,7 +9071,7 @@ options
|
||||
format _numeric_ bart.;
|
||||
%do i=1 %to &numcols;
|
||||
%if &&typelong&i=char or &fmt=Y %then %do;
|
||||
if findc(&&name&i,'"\'!!'0A0D09000E0F01021011'x) then do;
|
||||
if findc(&&name&i,'"\'!!'0A0D09000E0F010210111A'x) then do;
|
||||
&&name&i='"'!!trim(
|
||||
prxchange('s/"/\\"/',-1, /* double quote */
|
||||
prxchange('s/\x0A/\n/',-1, /* new line */
|
||||
@@ -9084,8 +9084,9 @@ options
|
||||
prxchange('s/\x02/\\u0002/',-1, /* STX */
|
||||
prxchange('s/\x10/\\u0010/',-1, /* DLE */
|
||||
prxchange('s/\x11/\\u0011/',-1, /* DC1 */
|
||||
prxchange('s/\x1A/\\u001A/',-1, /* SUB */
|
||||
prxchange('s/\\/\\\\/',-1,&&name&i)
|
||||
))))))))))))!!'"';
|
||||
)))))))))))))!!'"';
|
||||
end;
|
||||
else &&name&i=quote(cats(&&name&i));
|
||||
%end;
|
||||
@@ -15398,7 +15399,7 @@ data _null_;
|
||||
put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
|
||||
put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
|
||||
put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+10)*1.5)),''l''); ';
|
||||
put ' run; ';
|
||||
put ' ';
|
||||
put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
@@ -15454,8 +15455,8 @@ data _null_;
|
||||
put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' proc sql noprint; ';
|
||||
put ' create table &tmpds1 as ';
|
||||
put ' select cats(libname,''.'',memname) as fmtcat, ';
|
||||
put ' fmtname ';
|
||||
put ' select cats(libname,''.'',memname) as FMTCAT, ';
|
||||
put ' FMTNAME ';
|
||||
put ' from dictionary.formats ';
|
||||
put ' where fmttype=''F'' and libname is not null ';
|
||||
put ' and fmtname in (select format from &colinfo where format is not null) ';
|
||||
@@ -15480,7 +15481,7 @@ data _null_;
|
||||
put ' ';
|
||||
put ' proc sql; ';
|
||||
put ' create table &tmpds4 as ';
|
||||
put ' select a.*, b.length as maxw ';
|
||||
put ' select a.*, b.length as MAXW ';
|
||||
put ' from &colinfo a ';
|
||||
put ' left join &tmpds2 b ';
|
||||
put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
|
||||
@@ -15491,7 +15492,7 @@ data _null_;
|
||||
put ' call symputx( ';
|
||||
put ' cats(''fmtlen'',_n_), ';
|
||||
put ' /* vars need extra padding due to JSON escaping of special chars */ ';
|
||||
put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
|
||||
put ' min(32767,ceil((max(length,maxw)+10)*1.5)) ';
|
||||
put ' ,''l'' ';
|
||||
put ' ); ';
|
||||
put ' run; ';
|
||||
@@ -15566,7 +15567,7 @@ data _null_;
|
||||
put ' format _numeric_ bart.; ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F010210111A''x) then do; ';
|
||||
put ' &&name&i=''"''!!trim( ';
|
||||
put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
|
||||
put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
|
||||
@@ -15579,8 +15580,9 @@ data _null_;
|
||||
put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
|
||||
put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
|
||||
put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
|
||||
put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ ';
|
||||
put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
|
||||
put ' ))))))))))))!!''"''; ';
|
||||
put ' )))))))))))))!!''"''; ';
|
||||
put ' end; ';
|
||||
put ' else &&name&i=quote(cats(&&name&i)); ';
|
||||
put ' %end; ';
|
||||
@@ -20419,7 +20421,7 @@ data _null_;
|
||||
put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
|
||||
put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
|
||||
put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+10)*1.5)),''l''); ';
|
||||
put ' run; ';
|
||||
put ' ';
|
||||
put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
@@ -20475,8 +20477,8 @@ data _null_;
|
||||
put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' proc sql noprint; ';
|
||||
put ' create table &tmpds1 as ';
|
||||
put ' select cats(libname,''.'',memname) as fmtcat, ';
|
||||
put ' fmtname ';
|
||||
put ' select cats(libname,''.'',memname) as FMTCAT, ';
|
||||
put ' FMTNAME ';
|
||||
put ' from dictionary.formats ';
|
||||
put ' where fmttype=''F'' and libname is not null ';
|
||||
put ' and fmtname in (select format from &colinfo where format is not null) ';
|
||||
@@ -20501,7 +20503,7 @@ data _null_;
|
||||
put ' ';
|
||||
put ' proc sql; ';
|
||||
put ' create table &tmpds4 as ';
|
||||
put ' select a.*, b.length as maxw ';
|
||||
put ' select a.*, b.length as MAXW ';
|
||||
put ' from &colinfo a ';
|
||||
put ' left join &tmpds2 b ';
|
||||
put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
|
||||
@@ -20512,7 +20514,7 @@ data _null_;
|
||||
put ' call symputx( ';
|
||||
put ' cats(''fmtlen'',_n_), ';
|
||||
put ' /* vars need extra padding due to JSON escaping of special chars */ ';
|
||||
put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
|
||||
put ' min(32767,ceil((max(length,maxw)+10)*1.5)) ';
|
||||
put ' ,''l'' ';
|
||||
put ' ); ';
|
||||
put ' run; ';
|
||||
@@ -20587,7 +20589,7 @@ data _null_;
|
||||
put ' format _numeric_ bart.; ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F010210111A''x) then do; ';
|
||||
put ' &&name&i=''"''!!trim( ';
|
||||
put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
|
||||
put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
|
||||
@@ -20600,8 +20602,9 @@ data _null_;
|
||||
put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
|
||||
put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
|
||||
put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
|
||||
put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ ';
|
||||
put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
|
||||
put ' ))))))))))))!!''"''; ';
|
||||
put ' )))))))))))))!!''"''; ';
|
||||
put ' end; ';
|
||||
put ' else &&name&i=quote(cats(&&name&i)); ';
|
||||
put ' %end; ';
|
||||
@@ -22882,7 +22885,7 @@ data _null_;
|
||||
put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
|
||||
put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
|
||||
put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+10)*1.5)),''l''); ';
|
||||
put ' run; ';
|
||||
put ' ';
|
||||
put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
@@ -22938,8 +22941,8 @@ data _null_;
|
||||
put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' proc sql noprint; ';
|
||||
put ' create table &tmpds1 as ';
|
||||
put ' select cats(libname,''.'',memname) as fmtcat, ';
|
||||
put ' fmtname ';
|
||||
put ' select cats(libname,''.'',memname) as FMTCAT, ';
|
||||
put ' FMTNAME ';
|
||||
put ' from dictionary.formats ';
|
||||
put ' where fmttype=''F'' and libname is not null ';
|
||||
put ' and fmtname in (select format from &colinfo where format is not null) ';
|
||||
@@ -22964,7 +22967,7 @@ data _null_;
|
||||
put ' ';
|
||||
put ' proc sql; ';
|
||||
put ' create table &tmpds4 as ';
|
||||
put ' select a.*, b.length as maxw ';
|
||||
put ' select a.*, b.length as MAXW ';
|
||||
put ' from &colinfo a ';
|
||||
put ' left join &tmpds2 b ';
|
||||
put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
|
||||
@@ -22975,7 +22978,7 @@ data _null_;
|
||||
put ' call symputx( ';
|
||||
put ' cats(''fmtlen'',_n_), ';
|
||||
put ' /* vars need extra padding due to JSON escaping of special chars */ ';
|
||||
put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
|
||||
put ' min(32767,ceil((max(length,maxw)+10)*1.5)) ';
|
||||
put ' ,''l'' ';
|
||||
put ' ); ';
|
||||
put ' run; ';
|
||||
@@ -23050,7 +23053,7 @@ data _null_;
|
||||
put ' format _numeric_ bart.; ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F010210111A''x) then do; ';
|
||||
put ' &&name&i=''"''!!trim( ';
|
||||
put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
|
||||
put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
|
||||
@@ -23063,8 +23066,9 @@ data _null_;
|
||||
put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
|
||||
put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
|
||||
put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
|
||||
put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ ';
|
||||
put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
|
||||
put ' ))))))))))))!!''"''; ';
|
||||
put ' )))))))))))))!!''"''; ';
|
||||
put ' end; ';
|
||||
put ' else &&name&i=quote(cats(&&name&i)); ';
|
||||
put ' %end; ';
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
call symputx(cats('label',_n_),coalescec(label,name),'l');
|
||||
/* overwritten when fmt=Y and a custom format exists in catalog */
|
||||
if typelong='num' then call symputx(cats('fmtlen',_n_),200,'l');
|
||||
else call symputx(cats('fmtlen',_n_),min(32767,ceil((length+3)*1.5)),'l');
|
||||
else call symputx(cats('fmtlen',_n_),min(32767,ceil((length+10)*1.5)),'l');
|
||||
run;
|
||||
|
||||
%let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32);
|
||||
@@ -202,8 +202,8 @@
|
||||
%let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32);
|
||||
proc sql noprint;
|
||||
create table &tmpds1 as
|
||||
select cats(libname,'.',memname) as fmtcat,
|
||||
fmtname
|
||||
select cats(libname,'.',memname) as FMTCAT,
|
||||
FMTNAME
|
||||
from dictionary.formats
|
||||
where fmttype='F' and libname is not null
|
||||
and fmtname in (select format from &colinfo where format is not null)
|
||||
@@ -228,7 +228,7 @@
|
||||
|
||||
proc sql;
|
||||
create table &tmpds4 as
|
||||
select a.*, b.length as maxw
|
||||
select a.*, b.length as MAXW
|
||||
from &colinfo a
|
||||
left join &tmpds2 b
|
||||
on cats(a.format)=cats(upcase(b.fmtname))
|
||||
@@ -239,7 +239,7 @@
|
||||
call symputx(
|
||||
cats('fmtlen',_n_),
|
||||
/* vars need extra padding due to JSON escaping of special chars */
|
||||
min(32767,ceil((max(length,maxw)+3)*1.5))
|
||||
min(32767,ceil((max(length,maxw)+10)*1.5))
|
||||
,'l'
|
||||
);
|
||||
run;
|
||||
@@ -314,7 +314,7 @@
|
||||
format _numeric_ bart.;
|
||||
%do i=1 %to &numcols;
|
||||
%if &&typelong&i=char or &fmt=Y %then %do;
|
||||
if findc(&&name&i,'"\'!!'0A0D09000E0F01021011'x) then do;
|
||||
if findc(&&name&i,'"\'!!'0A0D09000E0F010210111A'x) then do;
|
||||
&&name&i='"'!!trim(
|
||||
prxchange('s/"/\\"/',-1, /* double quote */
|
||||
prxchange('s/\x0A/\n/',-1, /* new line */
|
||||
@@ -327,8 +327,9 @@
|
||||
prxchange('s/\x02/\\u0002/',-1, /* STX */
|
||||
prxchange('s/\x10/\\u0010/',-1, /* DLE */
|
||||
prxchange('s/\x11/\\u0011/',-1, /* DC1 */
|
||||
prxchange('s/\x1A/\\u001A/',-1, /* SUB */
|
||||
prxchange('s/\\/\\\\/',-1,&&name&i)
|
||||
))))))))))))!!'"';
|
||||
)))))))))))))!!'"';
|
||||
end;
|
||||
else &&name&i=quote(cats(&&name&i));
|
||||
%end;
|
||||
|
||||
@@ -169,7 +169,7 @@ data _null_;
|
||||
put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
|
||||
put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
|
||||
put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+10)*1.5)),''l''); ';
|
||||
put ' run; ';
|
||||
put ' ';
|
||||
put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
@@ -225,8 +225,8 @@ data _null_;
|
||||
put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' proc sql noprint; ';
|
||||
put ' create table &tmpds1 as ';
|
||||
put ' select cats(libname,''.'',memname) as fmtcat, ';
|
||||
put ' fmtname ';
|
||||
put ' select cats(libname,''.'',memname) as FMTCAT, ';
|
||||
put ' FMTNAME ';
|
||||
put ' from dictionary.formats ';
|
||||
put ' where fmttype=''F'' and libname is not null ';
|
||||
put ' and fmtname in (select format from &colinfo where format is not null) ';
|
||||
@@ -251,7 +251,7 @@ data _null_;
|
||||
put ' ';
|
||||
put ' proc sql; ';
|
||||
put ' create table &tmpds4 as ';
|
||||
put ' select a.*, b.length as maxw ';
|
||||
put ' select a.*, b.length as MAXW ';
|
||||
put ' from &colinfo a ';
|
||||
put ' left join &tmpds2 b ';
|
||||
put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
|
||||
@@ -262,7 +262,7 @@ data _null_;
|
||||
put ' call symputx( ';
|
||||
put ' cats(''fmtlen'',_n_), ';
|
||||
put ' /* vars need extra padding due to JSON escaping of special chars */ ';
|
||||
put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
|
||||
put ' min(32767,ceil((max(length,maxw)+10)*1.5)) ';
|
||||
put ' ,''l'' ';
|
||||
put ' ); ';
|
||||
put ' run; ';
|
||||
@@ -337,7 +337,7 @@ data _null_;
|
||||
put ' format _numeric_ bart.; ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F010210111A''x) then do; ';
|
||||
put ' &&name&i=''"''!!trim( ';
|
||||
put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
|
||||
put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
|
||||
@@ -350,8 +350,9 @@ data _null_;
|
||||
put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
|
||||
put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
|
||||
put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
|
||||
put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ ';
|
||||
put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
|
||||
put ' ))))))))))))!!''"''; ';
|
||||
put ' )))))))))))))!!''"''; ';
|
||||
put ' end; ';
|
||||
put ' else &&name&i=quote(cats(&&name&i)); ';
|
||||
put ' %end; ';
|
||||
|
||||
@@ -170,7 +170,7 @@ data _null_;
|
||||
put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
|
||||
put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
|
||||
put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+10)*1.5)),''l''); ';
|
||||
put ' run; ';
|
||||
put ' ';
|
||||
put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
@@ -226,8 +226,8 @@ data _null_;
|
||||
put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' proc sql noprint; ';
|
||||
put ' create table &tmpds1 as ';
|
||||
put ' select cats(libname,''.'',memname) as fmtcat, ';
|
||||
put ' fmtname ';
|
||||
put ' select cats(libname,''.'',memname) as FMTCAT, ';
|
||||
put ' FMTNAME ';
|
||||
put ' from dictionary.formats ';
|
||||
put ' where fmttype=''F'' and libname is not null ';
|
||||
put ' and fmtname in (select format from &colinfo where format is not null) ';
|
||||
@@ -252,7 +252,7 @@ data _null_;
|
||||
put ' ';
|
||||
put ' proc sql; ';
|
||||
put ' create table &tmpds4 as ';
|
||||
put ' select a.*, b.length as maxw ';
|
||||
put ' select a.*, b.length as MAXW ';
|
||||
put ' from &colinfo a ';
|
||||
put ' left join &tmpds2 b ';
|
||||
put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
|
||||
@@ -263,7 +263,7 @@ data _null_;
|
||||
put ' call symputx( ';
|
||||
put ' cats(''fmtlen'',_n_), ';
|
||||
put ' /* vars need extra padding due to JSON escaping of special chars */ ';
|
||||
put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
|
||||
put ' min(32767,ceil((max(length,maxw)+10)*1.5)) ';
|
||||
put ' ,''l'' ';
|
||||
put ' ); ';
|
||||
put ' run; ';
|
||||
@@ -338,7 +338,7 @@ data _null_;
|
||||
put ' format _numeric_ bart.; ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F010210111A''x) then do; ';
|
||||
put ' &&name&i=''"''!!trim( ';
|
||||
put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
|
||||
put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
|
||||
@@ -351,8 +351,9 @@ data _null_;
|
||||
put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
|
||||
put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
|
||||
put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
|
||||
put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ ';
|
||||
put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
|
||||
put ' ))))))))))))!!''"''; ';
|
||||
put ' )))))))))))))!!''"''; ';
|
||||
put ' end; ';
|
||||
put ' else &&name&i=quote(cats(&&name&i)); ';
|
||||
put ' %end; ';
|
||||
|
||||
@@ -312,7 +312,7 @@ data _null_;
|
||||
put ' call symputx(cats(''label'',_n_),coalescec(label,name),''l''); ';
|
||||
put ' /* overwritten when fmt=Y and a custom format exists in catalog */ ';
|
||||
put ' if typelong=''num'' then call symputx(cats(''fmtlen'',_n_),200,''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+3)*1.5)),''l''); ';
|
||||
put ' else call symputx(cats(''fmtlen'',_n_),min(32767,ceil((length+10)*1.5)),''l''); ';
|
||||
put ' run; ';
|
||||
put ' ';
|
||||
put ' %let tempds=%substr(_%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
@@ -368,8 +368,8 @@ data _null_;
|
||||
put ' %let tmpds4=%substr(col%sysfunc(compress(%sysfunc(uuidgen()),-)),1,32); ';
|
||||
put ' proc sql noprint; ';
|
||||
put ' create table &tmpds1 as ';
|
||||
put ' select cats(libname,''.'',memname) as fmtcat, ';
|
||||
put ' fmtname ';
|
||||
put ' select cats(libname,''.'',memname) as FMTCAT, ';
|
||||
put ' FMTNAME ';
|
||||
put ' from dictionary.formats ';
|
||||
put ' where fmttype=''F'' and libname is not null ';
|
||||
put ' and fmtname in (select format from &colinfo where format is not null) ';
|
||||
@@ -394,7 +394,7 @@ data _null_;
|
||||
put ' ';
|
||||
put ' proc sql; ';
|
||||
put ' create table &tmpds4 as ';
|
||||
put ' select a.*, b.length as maxw ';
|
||||
put ' select a.*, b.length as MAXW ';
|
||||
put ' from &colinfo a ';
|
||||
put ' left join &tmpds2 b ';
|
||||
put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
|
||||
@@ -405,7 +405,7 @@ data _null_;
|
||||
put ' call symputx( ';
|
||||
put ' cats(''fmtlen'',_n_), ';
|
||||
put ' /* vars need extra padding due to JSON escaping of special chars */ ';
|
||||
put ' min(32767,ceil((max(length,maxw)+3)*1.5)) ';
|
||||
put ' min(32767,ceil((max(length,maxw)+10)*1.5)) ';
|
||||
put ' ,''l'' ';
|
||||
put ' ); ';
|
||||
put ' run; ';
|
||||
@@ -480,7 +480,7 @@ data _null_;
|
||||
put ' format _numeric_ bart.; ';
|
||||
put ' %do i=1 %to &numcols; ';
|
||||
put ' %if &&typelong&i=char or &fmt=Y %then %do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F01021011''x) then do; ';
|
||||
put ' if findc(&&name&i,''"\''!!''0A0D09000E0F010210111A''x) then do; ';
|
||||
put ' &&name&i=''"''!!trim( ';
|
||||
put ' prxchange(''s/"/\\"/'',-1, /* double quote */ ';
|
||||
put ' prxchange(''s/\x0A/\n/'',-1, /* new line */ ';
|
||||
@@ -493,8 +493,9 @@ data _null_;
|
||||
put ' prxchange(''s/\x02/\\u0002/'',-1, /* STX */ ';
|
||||
put ' prxchange(''s/\x10/\\u0010/'',-1, /* DLE */ ';
|
||||
put ' prxchange(''s/\x11/\\u0011/'',-1, /* DC1 */ ';
|
||||
put ' prxchange(''s/\x1A/\\u001A/'',-1, /* SUB */ ';
|
||||
put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
|
||||
put ' ))))))))))))!!''"''; ';
|
||||
put ' )))))))))))))!!''"''; ';
|
||||
put ' end; ';
|
||||
put ' else &&name&i=quote(cats(&&name&i)); ';
|
||||
put ' %end; ';
|
||||
|
||||
Reference in New Issue
Block a user