1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-10 10:50:04 +00:00

fix: switching MAX for LENGTH to get max label value. Closes #300

This commit is contained in:
Allan Bowe
2022-08-17 20:54:14 +00:00
parent aabbcfdf6b
commit a2df4e35be
5 changed files with 34 additions and 34 deletions

34
all.sas
View File

@@ -8709,7 +8709,7 @@ options
@param [in] maxobs= (MAX) Provide an integer to limit the number of input rows @param [in] maxobs= (MAX) Provide an integer to limit the number of input rows
that should be converted to JSON that should be converted to JSON
<h4> Related Macros </h4> <h4> Related Files </h4>
@li mp_ds2fmtds.sas @li mp_ds2fmtds.sas
@version 9.2 @version 9.2
@@ -8857,7 +8857,7 @@ options
order by 1; order by 1;
create table &tmpds2( create table &tmpds2(
FMTNAME char(32), FMTNAME char(32),
MAX num length=3 LENGTH num
); );
%local catlist cat fmtlist i; %local catlist cat fmtlist i;
select distinct fmtcat into: catlist separated by ' ' from &tmpds1; select distinct fmtcat into: catlist separated by ' ' from &tmpds1;
@@ -8866,16 +8866,16 @@ options
proc sql; proc sql;
select distinct fmtname into: fmtlist separated by ' ' select distinct fmtname into: fmtlist separated by ' '
from &tmpds1 where fmtcat="&cat"; from &tmpds1 where fmtcat="&cat";
proc format lib=&cat cntlout=&tmpds3(keep=fmtname max); proc format lib=&cat cntlout=&tmpds3(keep=fmtname length);
select &fmtlist; select &fmtlist;
run; run;
proc sql; proc sql;
insert into &tmpds2 select distinct fmtname,max from &tmpds3; insert into &tmpds2 select distinct fmtname,length from &tmpds3;
%end; %end;
proc sql; proc sql;
create table &tmpds4 as create table &tmpds4 as
select a.*, b.max as maxw select a.*, b.length as maxw
from &colinfo a from &colinfo a
left join &tmpds2 b left join &tmpds2 b
on cats(a.format)=cats(upcase(b.fmtname)) on cats(a.format)=cats(upcase(b.fmtname))
@@ -15352,7 +15352,7 @@ data _null_;
put ' order by 1; '; put ' order by 1; ';
put ' create table &tmpds2( '; put ' create table &tmpds2( ';
put ' FMTNAME char(32), '; put ' FMTNAME char(32), ';
put ' MAX num length=3 '; put ' LENGTH num ';
put ' ); '; put ' ); ';
put ' %local catlist cat fmtlist i; '; put ' %local catlist cat fmtlist i; ';
put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; '; put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; ';
@@ -15361,16 +15361,16 @@ data _null_;
put ' proc sql; '; put ' proc sql; ';
put ' select distinct fmtname into: fmtlist separated by '' '' '; put ' select distinct fmtname into: fmtlist separated by '' '' ';
put ' from &tmpds1 where fmtcat="&cat"; '; put ' from &tmpds1 where fmtcat="&cat"; ';
put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname max); '; put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname length); ';
put ' select &fmtlist; '; put ' select &fmtlist; ';
put ' run; '; put ' run; ';
put ' proc sql; '; put ' proc sql; ';
put ' insert into &tmpds2 select distinct fmtname,max from &tmpds3; '; put ' insert into &tmpds2 select distinct fmtname,length from &tmpds3; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' proc sql; '; put ' proc sql; ';
put ' create table &tmpds4 as '; put ' create table &tmpds4 as ';
put ' select a.*, b.max as maxw '; put ' select a.*, b.length as maxw ';
put ' from &colinfo a '; put ' from &colinfo a ';
put ' left join &tmpds2 b '; put ' left join &tmpds2 b ';
put ' on cats(a.format)=cats(upcase(b.fmtname)) '; put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
@@ -20306,7 +20306,7 @@ data _null_;
put ' order by 1; '; put ' order by 1; ';
put ' create table &tmpds2( '; put ' create table &tmpds2( ';
put ' FMTNAME char(32), '; put ' FMTNAME char(32), ';
put ' MAX num length=3 '; put ' LENGTH num ';
put ' ); '; put ' ); ';
put ' %local catlist cat fmtlist i; '; put ' %local catlist cat fmtlist i; ';
put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; '; put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; ';
@@ -20315,16 +20315,16 @@ data _null_;
put ' proc sql; '; put ' proc sql; ';
put ' select distinct fmtname into: fmtlist separated by '' '' '; put ' select distinct fmtname into: fmtlist separated by '' '' ';
put ' from &tmpds1 where fmtcat="&cat"; '; put ' from &tmpds1 where fmtcat="&cat"; ';
put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname max); '; put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname length); ';
put ' select &fmtlist; '; put ' select &fmtlist; ';
put ' run; '; put ' run; ';
put ' proc sql; '; put ' proc sql; ';
put ' insert into &tmpds2 select distinct fmtname,max from &tmpds3; '; put ' insert into &tmpds2 select distinct fmtname,length from &tmpds3; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' proc sql; '; put ' proc sql; ';
put ' create table &tmpds4 as '; put ' create table &tmpds4 as ';
put ' select a.*, b.max as maxw '; put ' select a.*, b.length as maxw ';
put ' from &colinfo a '; put ' from &colinfo a ';
put ' left join &tmpds2 b '; put ' left join &tmpds2 b ';
put ' on cats(a.format)=cats(upcase(b.fmtname)) '; put ' on cats(a.format)=cats(upcase(b.fmtname)) ';
@@ -22769,7 +22769,7 @@ data _null_;
put ' order by 1; '; put ' order by 1; ';
put ' create table &tmpds2( '; put ' create table &tmpds2( ';
put ' FMTNAME char(32), '; put ' FMTNAME char(32), ';
put ' MAX num length=3 '; put ' LENGTH num ';
put ' ); '; put ' ); ';
put ' %local catlist cat fmtlist i; '; put ' %local catlist cat fmtlist i; ';
put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; '; put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; ';
@@ -22778,16 +22778,16 @@ data _null_;
put ' proc sql; '; put ' proc sql; ';
put ' select distinct fmtname into: fmtlist separated by '' '' '; put ' select distinct fmtname into: fmtlist separated by '' '' ';
put ' from &tmpds1 where fmtcat="&cat"; '; put ' from &tmpds1 where fmtcat="&cat"; ';
put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname max); '; put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname length); ';
put ' select &fmtlist; '; put ' select &fmtlist; ';
put ' run; '; put ' run; ';
put ' proc sql; '; put ' proc sql; ';
put ' insert into &tmpds2 select distinct fmtname,max from &tmpds3; '; put ' insert into &tmpds2 select distinct fmtname,length from &tmpds3; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' proc sql; '; put ' proc sql; ';
put ' create table &tmpds4 as '; put ' create table &tmpds4 as ';
put ' select a.*, b.max as maxw '; put ' select a.*, b.length as maxw ';
put ' from &colinfo a '; put ' from &colinfo a ';
put ' left join &tmpds2 b '; put ' left join &tmpds2 b ';
put ' on cats(a.format)=cats(upcase(b.fmtname)) '; put ' on cats(a.format)=cats(upcase(b.fmtname)) ';

View File

@@ -62,7 +62,7 @@
@param [in] maxobs= (MAX) Provide an integer to limit the number of input rows @param [in] maxobs= (MAX) Provide an integer to limit the number of input rows
that should be converted to JSON that should be converted to JSON
<h4> Related Macros </h4> <h4> Related Files </h4>
@li mp_ds2fmtds.sas @li mp_ds2fmtds.sas
@version 9.2 @version 9.2
@@ -210,7 +210,7 @@
order by 1; order by 1;
create table &tmpds2( create table &tmpds2(
FMTNAME char(32), FMTNAME char(32),
MAX num length=3 LENGTH num
); );
%local catlist cat fmtlist i; %local catlist cat fmtlist i;
select distinct fmtcat into: catlist separated by ' ' from &tmpds1; select distinct fmtcat into: catlist separated by ' ' from &tmpds1;
@@ -219,16 +219,16 @@
proc sql; proc sql;
select distinct fmtname into: fmtlist separated by ' ' select distinct fmtname into: fmtlist separated by ' '
from &tmpds1 where fmtcat="&cat"; from &tmpds1 where fmtcat="&cat";
proc format lib=&cat cntlout=&tmpds3(keep=fmtname max); proc format lib=&cat cntlout=&tmpds3(keep=fmtname length);
select &fmtlist; select &fmtlist;
run; run;
proc sql; proc sql;
insert into &tmpds2 select distinct fmtname,max from &tmpds3; insert into &tmpds2 select distinct fmtname,length from &tmpds3;
%end; %end;
proc sql; proc sql;
create table &tmpds4 as create table &tmpds4 as
select a.*, b.max as maxw select a.*, b.length as maxw
from &colinfo a from &colinfo a
left join &tmpds2 b left join &tmpds2 b
on cats(a.format)=cats(upcase(b.fmtname)) on cats(a.format)=cats(upcase(b.fmtname))

View File

@@ -233,7 +233,7 @@ data _null_;
put ' order by 1; '; put ' order by 1; ';
put ' create table &tmpds2( '; put ' create table &tmpds2( ';
put ' FMTNAME char(32), '; put ' FMTNAME char(32), ';
put ' MAX num length=3 '; put ' LENGTH num ';
put ' ); '; put ' ); ';
put ' %local catlist cat fmtlist i; '; put ' %local catlist cat fmtlist i; ';
put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; '; put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; ';
@@ -242,16 +242,16 @@ data _null_;
put ' proc sql; '; put ' proc sql; ';
put ' select distinct fmtname into: fmtlist separated by '' '' '; put ' select distinct fmtname into: fmtlist separated by '' '' ';
put ' from &tmpds1 where fmtcat="&cat"; '; put ' from &tmpds1 where fmtcat="&cat"; ';
put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname max); '; put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname length); ';
put ' select &fmtlist; '; put ' select &fmtlist; ';
put ' run; '; put ' run; ';
put ' proc sql; '; put ' proc sql; ';
put ' insert into &tmpds2 select distinct fmtname,max from &tmpds3; '; put ' insert into &tmpds2 select distinct fmtname,length from &tmpds3; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' proc sql; '; put ' proc sql; ';
put ' create table &tmpds4 as '; put ' create table &tmpds4 as ';
put ' select a.*, b.max as maxw '; put ' select a.*, b.length as maxw ';
put ' from &colinfo a '; put ' from &colinfo a ';
put ' left join &tmpds2 b '; put ' left join &tmpds2 b ';
put ' on cats(a.format)=cats(upcase(b.fmtname)) '; put ' on cats(a.format)=cats(upcase(b.fmtname)) ';

View File

@@ -234,7 +234,7 @@ data _null_;
put ' order by 1; '; put ' order by 1; ';
put ' create table &tmpds2( '; put ' create table &tmpds2( ';
put ' FMTNAME char(32), '; put ' FMTNAME char(32), ';
put ' MAX num length=3 '; put ' LENGTH num ';
put ' ); '; put ' ); ';
put ' %local catlist cat fmtlist i; '; put ' %local catlist cat fmtlist i; ';
put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; '; put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; ';
@@ -243,16 +243,16 @@ data _null_;
put ' proc sql; '; put ' proc sql; ';
put ' select distinct fmtname into: fmtlist separated by '' '' '; put ' select distinct fmtname into: fmtlist separated by '' '' ';
put ' from &tmpds1 where fmtcat="&cat"; '; put ' from &tmpds1 where fmtcat="&cat"; ';
put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname max); '; put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname length); ';
put ' select &fmtlist; '; put ' select &fmtlist; ';
put ' run; '; put ' run; ';
put ' proc sql; '; put ' proc sql; ';
put ' insert into &tmpds2 select distinct fmtname,max from &tmpds3; '; put ' insert into &tmpds2 select distinct fmtname,length from &tmpds3; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' proc sql; '; put ' proc sql; ';
put ' create table &tmpds4 as '; put ' create table &tmpds4 as ';
put ' select a.*, b.max as maxw '; put ' select a.*, b.length as maxw ';
put ' from &colinfo a '; put ' from &colinfo a ';
put ' left join &tmpds2 b '; put ' left join &tmpds2 b ';
put ' on cats(a.format)=cats(upcase(b.fmtname)) '; put ' on cats(a.format)=cats(upcase(b.fmtname)) ';

View File

@@ -376,7 +376,7 @@ data _null_;
put ' order by 1; '; put ' order by 1; ';
put ' create table &tmpds2( '; put ' create table &tmpds2( ';
put ' FMTNAME char(32), '; put ' FMTNAME char(32), ';
put ' MAX num length=3 '; put ' LENGTH num ';
put ' ); '; put ' ); ';
put ' %local catlist cat fmtlist i; '; put ' %local catlist cat fmtlist i; ';
put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; '; put ' select distinct fmtcat into: catlist separated by '' '' from &tmpds1; ';
@@ -385,16 +385,16 @@ data _null_;
put ' proc sql; '; put ' proc sql; ';
put ' select distinct fmtname into: fmtlist separated by '' '' '; put ' select distinct fmtname into: fmtlist separated by '' '' ';
put ' from &tmpds1 where fmtcat="&cat"; '; put ' from &tmpds1 where fmtcat="&cat"; ';
put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname max); '; put ' proc format lib=&cat cntlout=&tmpds3(keep=fmtname length); ';
put ' select &fmtlist; '; put ' select &fmtlist; ';
put ' run; '; put ' run; ';
put ' proc sql; '; put ' proc sql; ';
put ' insert into &tmpds2 select distinct fmtname,max from &tmpds3; '; put ' insert into &tmpds2 select distinct fmtname,length from &tmpds3; ';
put ' %end; '; put ' %end; ';
put ' '; put ' ';
put ' proc sql; '; put ' proc sql; ';
put ' create table &tmpds4 as '; put ' create table &tmpds4 as ';
put ' select a.*, b.max as maxw '; put ' select a.*, b.length as maxw ';
put ' from &colinfo a '; put ' from &colinfo a ';
put ' left join &tmpds2 b '; put ' left join &tmpds2 b ';
put ' on cats(a.format)=cats(upcase(b.fmtname)) '; put ' on cats(a.format)=cats(upcase(b.fmtname)) ';