自定义输出表以包含缺失变量 [英] Customize Output Table to Include Missing Variable

查看:19
本文介绍了自定义输出表以包含缺失变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Excel 文件,其中包含表壳(包括公式)和 SAS 输出的原始数据(例如,表 1 = 表壳;表 2 = 表 1 数据).

I have an excel file with sheets that contain both the table shells (including formulas) and the raw data output from SAS (eg. Sheet 1 = Table Shell; Sheet 2 = Table 1 Data).

我正在尝试更新表格数据,而无需重新执行表格外壳和相应的公式.然而,对于时间序列,我有 6 个参与者组,但有一个没有报告这个周期的数据.问题是缺少的组夹在中间,我无法将 SAS 输出粘贴到 excel 表中.我想在结果中输出那个缺失的组,但作为空白计数和百分比.

I am trying to update the table data without having to re-do the table shells and corresponding formulas. However, for the time series I have 6 participant groups, but one did not report data this cycle. The problem is that the missing group is sandwiched in the middle, and I can not paste the SAS output to the excel sheets. I want to output that missing group in the results but as blank counts and percents.

现在我正在做非常标准的 proc freq table var*Group/norow nocol 来获取计数和总百分比.

Right now I am doing pretty standard proc freq table var*Group/ norow nocol to get the count and total percent.

    Group 1 | Group 2 | ... | Missing Group | Group 5 | Group 6
N    500         303                           475        630
%    

提前感谢您的帮助!

推荐答案

不幸的是,我不认为 PROC FREQ 可以做一个完全缺失的列.PROC TABULATE 可以像大多数具有 CLASS 变量的过程一样,在 class 语句和 printmiss 上使用 preloadfmt告诉它创建所有逻辑分组(这可能很危险,所以在复杂的表上小心使用它).

I don't think PROC FREQ can do an entirely missing column, unfortunately. PROC TABULATE can, as can most procedures that have a CLASS variable, using preloadfmt on the class statement and printmiss to tell it to create all logical groupings (which can be dangerous, so use it with caution on complicated tables).

proc format;
value $genderf
'M'='Male'
'F'='Female'
'T'='Trans'
;
quit;
proc tabulate data=sashelp.class;
class sex/preloadfmt;
var height;
format sex $genderf.;
tables sex,height*mean/printmiss;
run;

使其在 PROC FREQ 中工作的唯一真正方法是对数据进行后处理(如果您正在寻找数据集而不是打印输出),或者为你错过的时间段,这当然会改变你的结果.

The only real way to make it work in PROC FREQ is to either postprocess the data (if you're looking for a dataset rather than a printed output), or to add a dummy row for your missing time period, which would of course alter your results.

这篇关于自定义输出表以包含缺失变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆