How can I loop through variables in SPSS? I want to avoid code duplication

后端 未结 7 1597
失恋的感觉
失恋的感觉 2021-01-03 02:31

Is there a \"native\" SPSS way to loop through some variable names? All I want to do is take a list of variables (that I define) and run the same procedure for them:

<
相关标签:
7条回答
  • 2021-01-03 03:18

    How can do this stata sintxis for spss.

    foreach var of varlist  pob_multi pob_multimod pob_multiex vul_car vul_ing nopob_nov espacio carencias carencias_3 ic_rezedu ic_asalud ic_ss  ic_cv  ic_sbv ic_ali  pobex pob  {
        tabstat `var' [w=factor] if pob_multi!=., stats(mean) save
        matrix define `var'_pp =(r(StatTotal))
        matrix rownames `var'_pp = `var'_pp
    }
    
    matrix tabla1 = (pob_multi_pp \ pob_multimod_pp \ pob_multiex_pp \ vul_car_pp \ vul_ing_pp \ nopob_nov_pp \ espacio_pp \ carencias_pp \ carencias_3_pp \ espacio_pp \ ic_rezedu_pp\ ic_asalud_pp \ ic_ss_pp \ ic_cv_pp \ ic_sbv_pp\ ic_ali_pp \ espacio_pp \ pobex_pp \ pob_pp   )
    matrix list tabla1
    

    thanks.

    0 讨论(0)
提交回复
热议问题