This post was updated on .
(First: sorry for my english, I'm from Hungary.)
I got a database and I have to do a rim weighting in it. I need more than 10 iterations, and I have to write a loop, but I can't. I mean I don't know how. 'Cause numbers are changing in every iteration... Any solutions? Without loop my syntax: COMPUTE help=universe/sample. EXECUTE. WEIGHT by help. fre var1. if (var1 = 1) weight = var1univ / var1samp . if (var1 = 2) weight = var1univ / var1samp . EXECUTE. compute weight = help * weight. execute. weight by weight. fre var2. if (var2 = 1) weight1 = var2univ / var2samp . if (var2 = 2) weight1 = var2univ / var2samp. compute weight = weight * weight1 . weight by weight. ... and so on for lots of variables. |
Just use the SPSSINC RAKE extension command
for this. Available from the SPSS Community website (www.ibm.com/developerworks/spssdevcentral).
It is included in the Python Essentials, which can be found under
Downloads for SPSS Statistics.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: MariaPetsch <[hidden email]> To: [hidden email] Date: 04/05/2012 01:53 PM Subject: [SPSSX-L] RIM weighting Sent by: "SPSSX(r) Discussion" <[hidden email]> /<small>(First: sorry for my english, I'm from Hungary.)/</small> I got a database and I have to do a rim weighting in it. I need more than 10 iterations, and I have to write a loop, but I can't. I mean I don't know how. 'Cause numbers are changing in every iteration... Any solutions? *Without loop my syntax:* COMPUTE help=universe/sample. EXECUTE. WEIGHT by help. fre var1. if (var1 = 1) weight = var1univ / var1samp . if (var1 = 2) weight = var1univ / var1samp . EXECUTE. compute weight = help * weight. execute. weight by weight. fre var2. if (var2 = 1) weight1 = var2univ / var2samp . if (var2 = 2) weight1 = var2univ / var2samp. compute weight = weight * weight1 . weight by weight. ... and so on for lots of variables. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/RIM-weighting-tp5621247p5621247.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
It would help but I have more than 5 variables. So I need a loop.
|
Administrator
|
In reply to this post by MariaPetsch
First off, what you have posted is *NOT* a viable approach to rolling your own Rim Weighting solution.
You need to define the issue specifically with indications of what are: universe?, sample?, var1univ?, var1samp? "... and so on for lots of variables." Define "... lots of variables." From what little I have read it is utter folly to have .. "lots of variables" in a Rim Weighting context. -- SPSS has 3 "Looping" constructs: LOOP (typically uses a VECTOR) or used within MATRIX language. DO REPEAT !DO !DOEND within the MACRO facility. The first 2 of these do *NOT* support procedures within the "LOOP". Rumor has it that there is a "Python Raking module" Maybe you can use that to to the Rim weighting? OTOH: http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14685324 suggests it uses the Advanced Stats to do a Log Linear model...If you don't have that you are SOL or back to the drawing board. Happy hunting in the flustercluck forest at the IBM website to locate "Rake". It seems from my brief reading on Rim Weighting that this would be fairly easy to do in MATRIX? ..... HTH, David
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by MariaPetsch
You can also find a rim weighting macro on
rivita.ru/spssmacros_en.shtml.
And also, the weighting could be performed via General Loglinear analysis. 06.04.2012 0:15, MariaPetsch написал: It would help but I have more than 5 variables. So I need a loop. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/RIM-weighting-tp5621247p5621409.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by MariaPetsch
have a look at this:
might be helpful. hth, vlad
On Thu, Apr 5, 2012 at 10:08 PM, MariaPetsch <[hidden email]> wrote: /<small>(First: sorry for my english, I'm from Hungary.)/</small> |
I will be out of the office on Friday 4/6. If you need immediate assistance please call the main office number 503/223-8248 or 800/788-1887 and an office assistant
will ensure that I get the message. Kelly |
Free forum by Nabble | Edit this page |