简体   繁体   English

如何 Plot 在 SAS 中随时间变化的一系列速率

[英]How to Plot a Series of Rates Over Time in SAS

I have 3 data sets: "Complete", "Incomplete", and "Case_List".我有 3 个数据集:“完整”、“不完整”和“Case_List”。 "Complete" contains records of individuals that have had a full series of a vaccine; “完整”包含已接种全系列疫苗的个人记录; "Incomplete" is identical except that the number of doses is less than the full series; “不完整”是相同的,只是剂量数量少于完整系列; and "Case_List" contains confirmed cases of a specific infection. “Case_List”包含特定感染的确诊病例。 Each data set contains a date, which I have transformed into week of the year (1:53), the individuals age, which I have divided into age groups(easiest to refer to age groups as 1:8, but their character variables), and an ID.每个数据集都包含一个日期,我已将其转换为一年中的一周(1:53),个人年龄,我已将其划分为年龄组(最容易将年龄组称为 1:8,但他们的字符变量) , 和一个 ID。 Every ID/record in "Complete" is, by definition, in "incomplete" as the individual received dose 1 before dose 2, but I don't have access to any personal identifiers to link them to the "Case_List" ID's.根据定义,“完成”中的每个 ID/记录都是“不完整”的,因为个人在第 2 剂之前接受了第 1 剂,但我无法访问任何个人标识符以将它们链接到“Case_List”ID。

I am new to SAS and have yet to find enough instruction on plotting to be able to plot a graph with the Case_List over Week(1:53) overlayed with Incomplete over Week(1:53) and Complete over Week(1:53), and all of that broken down by Age_Group(1:8).我是 SAS 的新手,并且还没有找到足够的绘图说明,以便能够 plot 绘制一个图表,其中 Case_List over Week(1:53) 覆盖了一周内未完成 (1:53) 和一周内完成 (1:53) ,以及所有这些都按 Age_Group(1:8) 细分。 If I can't get it figured out, I will just plot everything in R.如果我无法弄清楚,我只会 plot R 中的所有内容。

Other thoughts: Is it easier to merge Incomplete and Complete so there are only two data sets?其他想法:合并不完整和完整是否更容易,所以只有两个数据集? Is 8 iterations of a graph that already contains 3 lines going to be too messy for one plot?对于一个 plot 来说,已经包含 3 行的图的 8 次迭代是否会变得过于混乱?

Thanks for your help.谢谢你的帮助。

In SAS, you can't overlay plots from multiple datasets - you need to combine everything into one dataset.在 SAS 中,您不能叠加来自多个数据集的图 - 您需要将所有内容组合到一个数据集中。

You don't have to "merge" anything, though, just set them together and add a "category" variable.但是,您不必“合并”任何东西,只需将它们设置在一起并添加“类别”变量即可。

data incompletes completes case_list;
    call streaminit(7);
    do week = 1 to 53;
      do _i = 1 to 200;
        age = rand('Integer',1,8);
        _output = rand('Uniform');
        if _output lt (0.1+week/100) then output completes;
        if _output lt (0.2+week/80) then output incompletes;
        if _output lt (0.2-((week/150)**2)) then output case_list;
      end;
    end;
run;



data total;
  set completes(in=_comp) incompletes(in=_incomp) case_list(in=_case);
  if _comp then category="Complete";
  else if _incomp then category="Incomplete";
  else category="Disease Cases";
run;
    
    

Then you can overlay plots, depending on exactly what you want to do.然后,您可以叠加图,具体取决于您想要做什么。

proc sgplot data=total;
  vline week/group=category;
run;

You could add paneling by age as noted in the comments, or you have a few other options depending on what exactly you do, but I think this gets at what you really want to know - how do I overlay plots in SAS.您可以按照评论中的说明按年龄添加面板,或者根据您的具体操作,您还有其他一些选项,但我认为这正是您真正想知道的 - 我如何在 SAS 中叠加图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM