SAS-当组中的其他变量更改时,计数变量增加增加
我基本上是在尝试按2个变量进行分组并执行一个proc SQL的含义,但是由于以下原因,我的小组无法工作:以下是我试图获得的示例(假设这里的数据已正确排序)
现在我知道这不是平均功能的工作方式,因此我尝试考虑解决问题的方法,并且我发现这将有效:
,但是我不知道如何获得。 我已经尝试过
data want;
set have;
count + 1;
by User Var X;
if first.User then count = 1;
run;
,但是这似乎并没有完成技巧。关于如何解决这个问题的想法?
感谢您的阅读!
I am basically trying to group by 2 variables and perform a proc sql mean, however my group by won't work for the following reason : here's an example of what I am trying to get (Assuming the data here is sorted properly)
Now I know that this is not how the mean functions work so I've tried thinking about ways to resolve my issue and I've found that this would work :
However I don't know how I could obtain that.
I have tried
data want;
set have;
count + 1;
by User Var X;
if first.User then count = 1;
run;
However this does not seem to get the trick done. Any ideas on how to resolve this ?
Thanks for reading !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样?
Like this?