【发布时间】:2022-01-06 14:59:07
【问题描述】:
我正在尝试使用以下代码计算 SAS 代码中数据的四分位数:
PROC RANK data = final_states out = final_states percent;
var poverty_rate;
ranks pov_percentile;
var semi_poverty_rate;
ranks semi_pov_percentile;
RUN;
/*Create quartiles for poverty percentiles*/
DATA final_states;
set final_states;
if pov_percentile <= 25 then pov_quart = 1;
else if pov_percentile > 25 and pov_percentile <= 50 then pov_quart = 2;
else if pov_percentile > 50 and pov_percentile <= 75 then pov_quart = 3;
else pov_quart = 4;
RUN;
运行代码后,我使用以下命令运行了一个制表命令:
PROC FREQ final_states;
tables pov_quart;
RUN;
我得到了以下结果:
pov_quart Frequency
1 865
2 785
3 785
4 785
产生这些结果的代码有问题吗?
【问题讨论】:
-
你有很多关系吗,可能是 0 或其他小数字?
-
我使用 PROC SQL 进行了检查,第一个四分位数的最小值大于 0。我确实注意到第一个四分位数的最大值是 10.59,而第二个四分位数的最小值是 10.60。这可能是一个重要的数字问题吗?
标签: sas