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
- /
- SAS Programming
- /
- SAS Procedures
- /
- proc distance, distance inversion

Topic Options

- 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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-15-2013 02:26 PM

Hello

I am trying to 'invert' distance values from a proc distance so the output would correspond to the highest distance value would be coded as zero and a distance value of zero would be coded as the highest distance value. I can do this by multiplying the distance values by -1 and then adding the max value but was looking for an automated way to approach the solution. Is there an automated way to refer to the maximum value for a variable using a by statement?

For example:

Say you have 72 counties of data for per capita earnings and average education. You use this data to create a distance matrix using per capita earnings and average education as variables. Each county has a distance (method=euclid) that ranges from zero to a maximum value. Is there a way to refer to the maximum value of the distance by county?

thanks

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

Posted in reply to jdub

04-15-2013 02:40 PM

I am not very familiar with PROC DISTANCE, but I would think that this might do the trick, even though I'm not exactly sure how your data looks.

If each row has two values (earnings and education), then the inverse would be:

earnings_inv=earnings-max(earnings,education);

education_inv=education-max(earnings,education);

See if that helps.