How to sort the variable "rating" so that the value "AA" is first than "A"? Because my results are coming out like this:
A01
A02
A03
AA01
AA02
AA03
B01
B02
B03
C01
C02
C03
CODE:
proc sql;
create table resul_perf as select
date,
varl,
qtde_def,
case when def = 1 then sum(qtde_def)-qtde_def end as qtde_good,
sum(qtde_def) as qtde_total
from perf
group by DATE,variavel
having def = 1;
run;
@Thalitacosta WHY do you want to sort this way?
In the collating sequence digits come before characters and though A0 comes before AA. This is not only with SAS the case - like copy/paste your codes into Excel and sort there. You will get the same result.
I'm sure with a bit of effort some code could be written to arrange the data the way you have in mind. But why would you do that given that "nothing else" would sort the data this way.
rating = varl
variável = varl
How to sort the variable "rating" so that the value "AA" is first than "A"? Because my results are coming out like this:
A01
A02
A03
AA01
AA02
AA03
B01
B02
B03
C01
C02
C03
CODE:
proc sql;
create table resul_perf as select
date,
rating as varl,
qtde_def,
case when def = 1 then sum(qtde_def)-qtde_def end as qtde_good,
sum(qtde_def) as qtde_total
from perf
group by date,varl
having def = 1;
run;
@Thalitacosta WHY do you want to sort this way?
In the collating sequence digits come before characters and though A0 comes before AA. This is not only with SAS the case - like copy/paste your codes into Excel and sort there. You will get the same result.
I'm sure with a bit of effort some code could be written to arrange the data the way you have in mind. But why would you do that given that "nothing else" would sort the data this way.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: