我有一個數據集,根據他們訪問我們的移動診所的網站,患者數據。現在我已經寫了一系列命令,例如freqs和crosstabs來產生我需要的分析結果,但是我希望在每個站點爲患者完成這些工作,而不是整個數據集。 如果我只有一個站點,僅僅使用指定患者站點的變量的過濾器命令就足夠了,但可惜我有19個站點,所以我想找到一種方法來循環訪問我的代碼,以便爲每個站點生成這些輸出。也就是在1到19對於i說: 1.取第i個站點 2.計算該第i個站點 3.運行使用的患者這個濾波的數據表,在第i個站點SPSS:通過變量值循環
這裏的濾波器是我第一次嘗試使用DO REPEA。我也嘗試使用LOOP耳機。 但是它不起作用即使這些是閉環,我也會收到錯誤。 有沒有辦法在SPSS語法中做到這一點?請記住,我不太瞭解使用該插件的Python。
*LOOP #ind= 1 TO 19 BY 1.
DO REPEAT #ind= 1 TO 20.
****8888888888888888888888888888888888888888888888888888888 Select the Site here.
COMPUTE filter_site=(RCDSITE=#ind).
USE ALL.
FILTER BY filter_site.
**********************Step 3: Apply the necessary code for tables
*********Participation in the wellness screening, we actually do not care about those who did FP as we are not reporting it.
COUNT BIO= CheckB (1).
* COUNT FPS=CheckF(1).
* COUNT BnF= CheckB CheckF(1).
VAL LABEL BIO
1 ' Has the Wellness screening'
0 'Does not have the wellness screening'.
*VAL LABEL FPS
1 'Has the First patient survey'.
* VAL LABEL BnF
1 'Has either Wellness or FPS'
2 'Has both surveys done'.
FREQ BIO.
*************************Use simple math to calcuate those who only did the Wellness/First Patient survey FUB= F+B -FnB.
*******************************************************Executive Summary.
***********Blood Pressure.
FREQ BP.
*******************BMI.
FREQ BMI.
******************Waist Circumference.
FREQ OBESITY.
******************Glucose.
FREQ GLUCOSE.
*******************Cholesterol.
FREQ TC.
************************ Heamoglobin.
FREQ HAEMOGLOBIN.
*********************HIV.
FREQ HIV.
******************************************************************************I Lifestyle and General Health.
MISSING VALUES Gender GroupDep B8 to B13 ('').
******************Graphs 3.1