SAS Data Science

Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Viya (Machine Learning), SAS Visual Text Analytics, with point-and-click interfaces or programming
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jingsi
Calcite | Level 5

A starter SAS user got a little confused on functions and procedures. Thanks for bearing me on this.

Suppose that I have a string of numbers of interval ratio from a survey, but here is the problem. I don't know how to sort it by absolute value. Should I create a variable to contain these absolute values in procedures step or I can have other solutions by using some functions?

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Is the following what you are looking to do?

data have;

  input x;

  cards;

-5

-7

3

-1

4

;

proc sql noprint;

  create table want as

    select x

      from have

        order by abs(x)

  ;

quit;

View solution in original post

4 REPLIES 4
art297
Opal | Level 21

You've probably posted this in the wrong forum but you should post more info, anyhow, in order for others to know what you are seeking.  A small example of your data would help as well as an explanation of what you would ultimately like to accomplish with the data.

Jingsi
Calcite | Level 5

For example, I have some numbers gained from the individual survey such as -5 -7 3 -1 4 -6 1 ... and I want to sort them by the power of absolute values then I could chose to display the survey question items by this order.

art297
Opal | Level 21

Is the following what you are looking to do?

data have;

  input x;

  cards;

-5

-7

3

-1

4

;

proc sql noprint;

  create table want as

    select x

      from have

        order by abs(x)

  ;

quit;

Jingsi
Calcite | Level 5

Yes. Smiley Happy Thank you so much for helping me out.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2925 views
  • 1 like
  • 2 in conversation