- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 294 个
- 通用积分
- 2.0010
- 学术水平
- 13 点
- 热心指数
- 16 点
- 信用等级
- 13 点
- 经验
- 2473 点
- 帖子
- 112
- 精华
- 0
- 在线时间
- 330 小时
- 注册时间
- 2015-12-18
- 最后登录
- 2020-8-29
博士生
还不是VIP/贵宾
- 威望
- 0 级
- 论坛币
 - 294 个
- 通用积分
- 2.0010
- 学术水平
- 13 点
- 热心指数
- 16 点
- 信用等级
- 13 点
- 经验
- 2473 点
- 帖子
- 112
- 精华
- 0
- 在线时间
- 330 小时
- 注册时间
- 2015-12-18
- 最后登录
- 2020-8-29
 | 开心 2017-1-12 09:15:37 |
|---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到
|
经管之家送您一份
应届毕业生专属福利!
求职就业群
感谢您参与论坛问题回答
经管之家送您两个论坛币!
+2 论坛币
- /*解决实际问题之SAS画分组柱状-折线图*/
- data sbp;
- input id age sbp hy;
- cards;
- 1 4 70 0
- 2 4 75 1
- 3 4 73 1
- 4 5 76 1
- 5 5 80 1
- 6 5 78 1
- 7 5 58 0
- 8 6 80 1
- 9 6 90 1
- 10 7 76 0
- 11 7 90 1
- 12 7 98 1
- 13 8 89 0
- ;
- proc sql noprint;
- create table test1 as
- select mean(sbp) as sbp_mean,
- age
- from sbp
- group by age
- order by age
- ;
- quit;
- proc sql noprint;
- create table test2 as
- select count(hy) as hy1,
- age
- from sbp
- where hy=1
- group by age;
- quit;
- proc sql noprint;
- create table test3 as
- select count(hy) as hy0,
- age,
- from sbp
- where hy=0
- group by age;
- quit;
- proc sort data=test2;by age;run;
- proc sort data=test3;by age;run;
- data test4;
- merge test2 test3;
- by age;
- if hy0=. then hy0=0;
- else if hy1=. then hy1=0;
- percent=hy1/(hy0+hy1);
- format percent percent8.2;
- run;
- /*SAS 9.4 M2*/
- proc sgplot data=test1 noautolegend;
- series x=age y=sbp_mean /
- lineattrs=(thickness=2 color="#00b8e5") dataskin=pressed
- markers markerattrs=(symbol=trianglefilled color=red size=10);
- yaxis ranges=(0-90) label="sbp平均水平";
- xaxis label="年龄";
- run;
- /*SAS 9.4 M3*/
- proc sgplot data=test1 noautolegend;
- vbarbasic age / response=sbp_mean dataskin=gloss fillattrs=(color="#00bc57")
- baselineattrs=(thickness=0) barwidth=0.7;
- series x=age y=sbp_mean / arrowheadpos=end arrowheadshape=filled
- lineattrs=(thickness=5 color="#00b8e5") dataskin=pressed
- markers markerattrs=(symbol=circlefilled color=red size=15);
- yaxis label="sbp平均水平";
- xaxis label="年龄";
- run;
- /*SAS 9.4 M2*/
- proc sgplot data=test4 noautolegend;
- series x=age y=percent /
- lineattrs=(thickness=5 color="#00bc57") dataskin=pressed
- markers markerattrs=(symbol=circlefilled color=red size=15);
- yaxis label="hy=1的百分比";
- xaxis label="年龄";
- run;
- /*SAS 9.4 M3*/
- proc sgplot data=test4 noautolegend;
- vbarbasic age / response=percent dataskin=gloss fillattrs=(color="#00bc57")
- baselineattrs=(thickness=0) barwidth=0.7;
- series x=age y=percent / arrowheadpos=end arrowheadshape=filled
- lineattrs=(thickness=5 color="#00b8e5") dataskin=pressed
- markers markerattrs=(symbol=circlefilled color=red size=10);
- yaxis label="hy=1的百分比";
- xaxis label="年龄";
- run;
复制代码

扫码加我 拉你入群
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
|
|
-
总评分: 论坛币 + 5
学术水平 + 1
热心指数 + 1
信用等级 + 1
查看全部评分
|