我在编程方面是新手,我必须做一些如下的工作:我有两个表,例如:
TableA
+-------+
| name |
+-------+
| name1 |
| name2 |
| name3 |
+-------+TableB
+-------+-------+
| name | tips |
+-------+-------+
| name1 | tips1 |
| name1 | tips2 |
| name1 | tips3 |
| name2 | tips4 |
| name2 | tips5 |
| name3 | tips6 |
+-------+-------+我想要一张这样的桌子:
TableC
+-------+---------------------+
| name | tips |
+-------+---------------------+
| name1 | tips1, tips2, tips3 |
| name2 | tips4, tips5 |
| name3 | tips6 |
+-------+---------------------+发布于 2017-06-22 13:53:54
data TableC;
set TableB;
by name;
length t_tips $ 1000;
retain t_tips;
if (first.name) then
do;
t_tips=strip(tips);
end;
else
do;
t_tips=strip(tips) ||", "||strip(t_tips);
end;
if (last.name) then output;
drop tips;
run;https://stackoverflow.com/questions/44670995
复制相似问题