|
Hi Everyone,
I have a question about syntax for rounding up variable values. I ran a multiple imputation, and the resultant imputed data sets have variable values that are decimals. I need the values to be whole integers for an ordinal variable. For instance, I have a four-point ordinal variable, and values between 3.5 and 4 need to be rounded up to 4. How can I round up values for these variables? All I can find on the help function is an option to round up single values, but I have tens of values that need to be rounded up. This option would take forever. Thanks! Courtney Courtney Cronley, Ph.D. Postdoctoral Associate Center of Alcohol Studies Rutgers University [hidden email] ===================== 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 |
|
Hi,
There is SPSS syntax here that will specifically round up non-integer values: http://www.tek-tips.com/viewthread.cfm?qid=1118740&page=5 There is also a function in MS Excel - it's called ROUNDUP. The Excel function certainly works, but I had problems with the SPSS syntax (probably my fault, not the syntax's!) Best wishes, Julius On 22/09/2010 17:17, Courtney M. Cronley wrote: > Hi Everyone, > > I have a question about syntax for rounding up variable values. I ran a multiple imputation, and the resultant imputed data sets have variable values that are decimals. I need the values to be whole integers for an ordinal variable. For instance, I have a four-point ordinal variable, and values between 3.5 and 4 need to be rounded up to 4. How can I round up values for these variables? All I can find on the help function is an option to round up single values, but I have tens of values that need to be rounded up. This option would take forever. > > Thanks! > > Courtney > > Courtney Cronley, Ph.D. > Postdoctoral Associate > Center of Alcohol Studies > Rutgers University > [hidden email] > > ===================== > 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 ===================== 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 Courtney M. Cronley
Courtney,
The spss function to use is rnd(x), where x is a numeric value. Since you have many variables that need to be rounded, I'd suggest using the do repeat command as in Do repeat a=x1 to x5 y4 to y24. + compute a=rnd(a). end repeat. Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Courtney M. Cronley Sent: Wednesday, September 22, 2010 12:18 PM To: [hidden email] Subject: Rounding Options Hi Everyone, I have a question about syntax for rounding up variable values. I ran a multiple imputation, and the resultant imputed data sets have variable values that are decimals. I need the values to be whole integers for an ordinal variable. For instance, I have a four-point ordinal variable, and values between 3.5 and 4 need to be rounded up to 4. How can I round up values for these variables? All I can find on the help function is an option to round up single values, but I have tens of values that need to be rounded up. This option would take forever. Thanks! Courtney Courtney Cronley, Ph.D. Postdoctoral Associate Center of Alcohol Studies Rutgers University [hidden email] ===================== 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 ===================== 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 |
| Free forum by Nabble | Edit this page |
