如何根据共同ID从表中合并行? Sas,例如
我知道那里有一些类似的问题,但是成为一个菜鸟,我想找到对我有用的特定代码。
在SAS EG项目中,我有一个名为Work.Query_For_Table1的查询结果,其中4列AS: ID1 ID2 Text1 Text2
当我每个ID1具有多个ID2,这是唯一的,我想根据ID1合并行,并将包含文本的列与分隔线合并,例如: 资料来源:
ID1 ID2 TEXT1 TEXT2
1 1 ABC DEF
1 2 GHI JKL
2 1 ABC DEF
结果:
ID1 TEXT
1 ABC,DEF,GHI,JKL
2 ABC
对代码有任何想法(包括我已经在项目中已经拥有的查询结果中的调用)吗?
谢谢你!
I know there are some similar questions out there, but being a total noob, I would like to find the specific code that would work for me.
In a SAS EG project, I have a query result named WORK.QUERY_FOR_TABLE1 with 4 columns as:
ID1 ID2 TEXT1 TEXT2
As I have multiple ID2 per ID1, which is unique, I would like to merge rows based on ID1 and columns containing text with a divider, such as:
Source:
ID1 ID2 TEXT1 TEXT2
1 1 ABC DEF
1 2 GHI JKL
2 1 ABC DEF
Result:
ID1 TEXT
1 ABC,DEF,GHI,JKL
2 ABC
Any idea for the code (including calling in the query result I already have in the project)?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将必须在企业指南项目中添加一些实际的SAS代码才能做到这一点。
创建一个新的变量,并使用CATX()函数来构建字符串。通过小组处理。
You will have to add some actual SAS code into your Enterprise Guide project to do that.
Create a new variable and use CATX() function to build the string. Use BY group processing.