我有一个逐行学生信息的数据集,例如:
1234 2013秋季国际
2234 2013年秋季国内
2234 2013年秋季国内
2235 2013秋季国际
2014秋季国际7234
7234 2014秋季国内
7234 2014秋季国内
7235国际2014秋季
8234 2013春季国际
8234 2013年春季国内
8234 2013年春季国内
8235 2013春季国际
9234国际2014春季
9234 2014年春季国内
9234 2014年春季国内
9235国际2014春季
上面的数据表示ID、期限和公民身份。我已经使用proc freq和tabulate来尝试获得百分比,但我一直在获得整个数据集的总体百分比。我希望每个学期的百分比,即2013年秋季的百分比总和应该是2个项目(国际和国内),并等于100%本身。
发布于 2014-08-01 02:50:58
您需要在表格中使用rowpctn
或colpctn
。
data have;
input
id semester $ year origin :$15.
;
datalines;
1234 Fall 2013 Domestic
2234 Fall 2013 Domestic
2234 Fall 2013 Domestic
2235 Fall 2013 International
7234 Fall 2014 International
7234 Fall 2014 Domestic
7234 Fall 2014 Domestic
7235 Fall 2014 International
8234 Spring 2013 International
8234 Spring 2013 Domestic
8234 Spring 2013 Domestic
8235 Spring 2013 International
9234 Spring 2014 International
9234 Spring 2014 Domestic
9234 Spring 2014 Domestic
9235 Spring 2014 International
;;;;
run;
proc tabulate data=have;
class semester year origin;
tables semester*year, origin*(n rowpctn);
run;
https://stackoverflow.com/questions/25066319
复制相似问题