Proc Tabulate,加权分类变量

时间:2016-01-20 11:19:58

标签: sas

我刚刚意识到,当您在SAS中使用proc制表时,如果您正在使用分类变量,那么WEIGHT不起作用!到底有没有绕过那个?

说明:配偶,孩子,父母是二元变量(1与生活在一起,0与不生活)

这是我的代码:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:Repeater ID="Repeater1" runat="server">
        <HeaderTemplate>
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-body table-responsive no-padding">
                            <table id="nutzer" class="table table-hover table-condensed">
                                <thead>
                                    <tr>
                                        <th>Nr</th>
                                        <th>Kdnr</th>
                                        <th>Benutzername</th>
                                        <th>Name</th>
                                        <th>E-Mail</th>
                                        <th>Wo/Bereich</th>
                                        <th>Gesperrt</th>
                                        <th>Details</th>
                                    </tr>
                                </thead>
                                <tbody data-link="row" class="rowlink">
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td><%# Eval("Nr").ToString()%></td>
                <td><%# Eval("ADRNR").ToString() %></td>
                <td><%# Eval("Name").ToString()%></td>
                <td><%# Eval("Langname").ToString()%></td>
                <td><%# Eval("Email").ToString()%></td>
                <td><%# Eval("Wo").ToString()%></td>
                <td><span class="glyphicon glyphicon-<%# Convert.ToBoolean(Eval("gesperrt").ToString()) ? "ok" : "remove" %>" aria-hidden="true"></span></td>
                <td><a href="UserDetails.aspx?nr=<%# Eval("Nr").ToString()%>">Details</a></td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </tbody>
            </table>
            </div><!-- /.box-body -->
            </div><!-- /.box -->
            </div><!-- /.col-xs-12 -->
            </div><!-- /.row -->
        </FooterTemplate>
    </asp:Repeater>
<script src="plugins/datatables/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('#nutzer').dataTable({
            "bPaginate": true,
            "bLengthChange": false,
            "bFilter": false,
            "bSort": true,
            "bInfo": true,
            "bAutoWidth": false
        });
    });
</script>

1 个答案:

答案 0 :(得分:0)

我认为您需要将PerWt添加为var才能使用weight选项调用它。我在下面模拟了你的数据并尝试了几种不同的方法。

data censusrounds;
infile datalines delimiter=',';
input spouse child parent sex agegroup $ sample rowpctN perwt;
datalines;
1, 0, 0, 0, a, 5, .6, .20
0, 1, 0, 0, a, 5, .5, .30
0, 0, 1, 0, a, 5, .4, .25
1, 0, 0, 1, a, 5, .3, .10
0, 1, 0, 1, a, 5, .2, .15
;
run;
PROC tabulate
DATA=censusrounds;

CLASS spouse parent SEX AGEGROUP child sample;
var rowpctN perwt;

TABLE sample*SEX*AGEGROUP,
    RowPctN*(spouse parent child);
;
WEIGHT PERWT;

RUN;