cool hit counter SPSS calls python (5): reading of output results_Intefrankly

SPSS calls python (5): reading of output results


SPSS is very powerful, it can output a very large amount of statistical information, but sometimes we don't need that much information, we just need that little bit of information, then we can output the specified information in the output screen through Python.

BEGIN PROGRAM.

import spss,spssaux

cmd="DESCRIPTIVES VARIABLES=salary,salbegin,jobtime,prevexp."

desc_table,Errcode=spssaux.CreateXMLOutput(

cmd,

omsid="Descriptives")

meansal=spssaux.getValuesFromXMLWorkspace(

desc_table,

tableSubtype="Descriptive Statistics",

rowCategory="Current Salary",

colCategory="Mean",

cellAttrib="text")

if meansal:

print "The average salary is: ", meansal[0]

END PROGRAM.

At this point we can see that the output screen is

The average salary is: $34,419.57

If we want to know the starting salary, we just need to change the code

BEGIN PROGRAM.

import spss,spssaux

cmd="DESCRIPTIVES VARIABLES=salary,salbegin,jobtime,prevexp."

desc_table,Errcode=spssaux.CreateXMLOutput(

cmd,

omsid="Descriptives")

meansal=spssaux.getValuesFromXMLWorkspace(

desc_table,

tableSubtype="Descriptive Statistics",

rowCategory="Beginning Salary",

colCategory="Mean",

cellAttrib="text")

if meansal:

print " The starting salary is: ", meansal[0]

END PROGRAM.

At this point you can see that it is

Starting salary is: $17,016.09

Once we understand this functionality, we can design our own programs to output the results we want, which is one of the basic skills for designing your own extension bundle


Recommended>>
1、China iCloud user data migration ready Apple has no reservations
2、TFBOYS company fan blockchain website unauthorized will pursue legal responsibility
3、Microsoft launches three new machine learning tools developers can quickly build AI apps
4、Ding Lei Dont imagine Bitcoin as blockchain blockchain itself has many applications
5、2018 Leading Talents in Cybersecurity and Information Technology Industry in Lingang Economic and Technological Development Zone Begins Declaration

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号