我有一组如下格式的数据,想要统计频数,用来proc tabulate,可是还是没法达到我想要的效果,想请高人指点一下:
stas year month day tem
123 1951 1 1 2
123 1951 1 2 2
123 1951 2 1 2
123 1951 2 2 2
123 1951 3 1 2
123 1951 3 2 2
123 1952 1 1 2
123 1952 1 2 2
123 1952 2 1 2
123 1952 2 2 2
123 1952 3 1 2
123 1952 3 2 2
123 1953 1 1 2
123 1953 1 2 2
123 1953 2 1 2
123 1953 2 2 2
123 1953 3 1 2
123 1953 3 2 2
246 1951 1 1 2
246 1951 1 2 2
246 1951 2 1 2
246 1951 2 2 2
246 1951 3 1 2
246 1951 3 2 2
246 1952 1 1 2
246 1952 1 2 2
246 1952 2 1 2
246 1952 2 2 2
246 1952 3 1 2
246 1952 3 2 2
246 1953 1 1 2
246 1953 1 2 2
246 1953 2 1 2
246 1953 2 2 2
246 1953 3 1 2
246 1953 3 2 2
789 1951 1 1 2
789 1951 1 2 2
789 1951 2 1 2
789 1951 2 2 2
789 1951 3 1 2
789 1951 3 2 2
789 1952 1 1 2
789 1952 1 2 2
789 1952 2 1 2
789 1952 2 2 2
789 1952 3 1 2
789 1952 3 2 2
789 1953 1 1 2
789 1953 1 2 2
789 1953 2 1 2
789 1953 2 2 2
789 1953 3 1 2
789 1953 3 2 2
我自己写的语句是这样的:
proc tabulate data=test.test1 out=test.test2;
class stas tem year;
table stas*tem,year all;
run;
output 出来的结果:
数据集是这样的:
我希望数据集最后出来的结果和output的格式是类似的,也就是把原来变量 year 的值作为新的数据集里的变量名,而且type of , page for, table for 这几个我不想要,只想要 例如 当stas=123 时,tem=1 在 year=1951 时出现的频数。
希望哪位大侠可以帮帮忙,叩谢哦!