turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Data Mining
- /
- Q about absolute value

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-30-2011 08:09 AM

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?

Accepted Solutions

Solution

09-30-2011
08:34 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-30-2011 08:34 AM

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;

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-30-2011 08:17 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-30-2011 08:29 AM

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.

Solution

09-30-2011
08:34 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-30-2011 08:34 AM

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-30-2011 08:37 AM

Yes. Thank you so much for helping me out.