Skip to main content
added 146 characters in body
Source Link
user3490
  • 819
  • 5
  • 5

SAS - 217 (I think)

Input should be placed on the line after the cards4 statement, or on the appropriate punch cards for your system. I think this approach saves a few characters vs. attempting to quote the input.

data a;
input;
S = upcase(compress(_INFILE_,,'ak'));
do i=1 to length(S);
l=substr(S,i,1);
output;
end;
cards4;
;;;;
run;
proc sql;
select l into :o separated by '' from
(select l, 1/count(l) as f from a group by l) order by f;
quit;

I'm aware that this doesn't meet the full spec, as it only returns characters that appear in the input string. I might need to rethink this a bit.

SAS - 217 (I think)

Input should be placed on the line after the cards4 statement, or on the appropriate punch cards for your system. I think this approach saves a few characters vs. attempting to quote the input.

data a;
input;
S = upcase(compress(_INFILE_,,'ak'));
do i=1 to length(S);
l=substr(S,i,1);
output;
end;
cards4;
;;;;
run;
proc sql;
select l into :o separated by '' from
(select l, 1/count(l) as f from a group by l) order by f;
quit;

SAS - 217 (I think)

Input should be placed on the line after the cards4 statement, or on the appropriate punch cards for your system. I think this approach saves a few characters vs. attempting to quote the input.

data a;
input;
S = upcase(compress(_INFILE_,,'ak'));
do i=1 to length(S);
l=substr(S,i,1);
output;
end;
cards4;
;;;;
run;
proc sql;
select l into :o separated by '' from
(select l, 1/count(l) as f from a group by l) order by f;
quit;

I'm aware that this doesn't meet the full spec, as it only returns characters that appear in the input string. I might need to rethink this a bit.

Source Link
user3490
  • 819
  • 5
  • 5

SAS - 217 (I think)

Input should be placed on the line after the cards4 statement, or on the appropriate punch cards for your system. I think this approach saves a few characters vs. attempting to quote the input.

data a;
input;
S = upcase(compress(_INFILE_,,'ak'));
do i=1 to length(S);
l=substr(S,i,1);
output;
end;
cards4;
;;;;
run;
proc sql;
select l into :o separated by '' from
(select l, 1/count(l) as f from a group by l) order by f;
quit;