×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

BY: how to make a sort of its own, not alphabetically

BY: how to make a sort of its own, not alphabetically

BY: how to make a sort of its own, not alphabetically

(OP)
Hello!

using the BY Phrase the columns are always sorted alphabetically. Yet in most reports I have to create I need a different sort (mostly arbitrary and doesn't follow a pattern). Those sorts occur only when I have about 2 to 5 values within the column used for sorting the data.

I know I can change the order by using SET STYLEMODE=FIXED and then use IN and shuffle the alphabetical order created by BY. But how can I do this without a FIXED Stylemode?

Eva

RE: BY: how to make a sort of its own, not alphabetically

Eva,

You can simply use DEFINEd field, to sort on it.
This is a simple example:

DEFINE FILE CAR
WEIGHT/I5 = IF CAR EQ 'TOYOTA' OR 'AUDI' THEN 1 ELSE
            IF CAR EQ 'BMW' THEN 2 ELSE 3;
END

TABLE FILE CAR
SUM SALES
BY WEIGHT NOPRINT
BY CAR
END

Hope this helps
  Grzegorz

RE: BY: how to make a sort of its own, not alphabetically

(OP)
Hi Grzegorz,

Great. Nice trick and it works perfectly. Thanks a lot.

Eva

RE: BY: how to make a sort of its own, not alphabetically

An even easier way is to use the 'ROWS' keyword:

DEFINE FILE CAR
WEIGHT/I5 = IF CAR EQ 'TOYOTA' OR 'AUDI' THEN 1 ELSE
            IF CAR EQ 'BMW' THEN 2 ELSE 3;
END

TABLE FILE CAR
SUM SALES
BY WEIGHT NOPRINT
BY CAR
ROWS TOYOTA OR AUDI AS 'LABEL1' OVER BMW AS 'LABEL2' OVER ...
END

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close