[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Creating a distance variable in SPSS
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /wsr/ - Worksafe Requests

Thread replies: 10
Thread images: 2
File: IBM_SPSS_v23.png (15 KB, 120x120) Image search: [Google]
IBM_SPSS_v23.png
15 KB, 120x120
I'm using SPSS to create a variable that is supposed to show the numerical distance between a case and a given value. My mathmatical/programming skills are too limited to figure this out though and I could not find any tutorial pertaining to this online. Does anyone here have an idea on how to compute this?

To be clear, what I need is the distance from a case to a given number where the given number is always the same for instance at a given value of 10:
Case says: 4
Distance is 6

Case says: 15
Distance is 5

I have no clue how to fix this mathmatically or as a function in SPSS. Any help would be greatly appreciated.
>>
dist=|case-10|
?
>>
>>135687
Thats what I tried first but I need distances as positive numbers, that method also gives negative answers.
>>
File: edgar wat.jpg (23 KB, 299x169) Image search: [Google]
edgar wat.jpg
23 KB, 299x169
>>135690
>absolute value
>negative numbers
>>
>>135691
I literally do not know what those things mean. I'm a political science student so I can't into math at all... Am I missing something here?
>>
>>135694
https://en.wikipedia.org/wiki/Absolute_value

I don't believe you have never heard about this.
>>
>>135687
I get it now... the | | is the important bit.

>>135690
>>135694
I'm retarded.

Thank you very very much.
>>
Update: SPSS can't handle the | | part. I found out that you can compute a variable with negative and positive values into an absolute value variable using the command:

COMPUTE new_var=ABS(old_var)

So I guess to get it to work in SPSS takes 2 steps.
>>
>>135703
If only there were some way to combine two expressions.
>>
>>135709
I sense a bit of sarcasm but thats okay, I know I'm completely retarded when it comes to this stuff but it works now so I'm happy enough :)
Thread replies: 10
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.