SAS 我可以逆向进行 sas 过程观察吗
我知道Sas在处理时从数据集顶部的观察开始,然后继续进行下一个直到到达底部观察,但是有没有一种简单的方法可以让sas首先处理底部观察,然后再处理到顶部?
I know that Sas starts with the observation at the top of a dataset when processing and proceeds to the next until it reaches the bottom observation, but is there an easy way to make sas process the bottom observation first and then work its way to the top?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用nobs和point向后处理它,而无需执行任何中间步骤。 下面是一个示例:
请参阅此 pdf 的第 2 页了解所有有趣的详细信息。
You can use nobs and point to process it backwards without having to do any intermediate steps. Here's an example:
See page 2 of this pdf for all the juicy details.
您当然可以将数据更改为相反的顺序,然后从上到下处理。 将一个变量添加到充当索引的数据集。然后按该变量对数据集进行降序排序。
You certainly can change your data to be in reverse order, then process top down. Add a variable to the data set which acts as an index..then sort the data set descending by that variable.
您可以使用 PROC SQL 在一步中翻转观察顺序:
这里的关键是order by monotonic() desc,它翻译为“按观察值降序排序”。
或者,您可以创建一个视图(而不是创建表),该视图将引用原始表,但以相反的观察编号顺序:
You can flip your observations order in a single step using PROC SQL:
The key here is order by monotonic() desc which translates as "sort by descending observation numbers".
Alternatively, you can create a view (instead of creating a table) which will refer to the original table, but in a reverse observation number order: