Hi all I'm using Stata 13.1 in Windows 7,
I have a set of variables _0, _1, _2, _3, _4 upto _90. I want to generate a set of summary variables that summarise the variables into 5 year age bands - so _0, _1, _2, _3, and _4 would be _04, followed by _5, _6, _7, _8, _9 would be _59 all the way to _85, _86, _87, _88, _89 would be _8589.
Is there a way I can automate this in Stata? I wondered whether I could reshape the data and try and summarise in a different manner.
I have a set of variables _0, _1, _2, _3, _4 upto _90. I want to generate a set of summary variables that summarise the variables into 5 year age bands - so _0, _1, _2, _3, and _4 would be _04, followed by _5, _6, _7, _8, _9 would be _59 all the way to _85, _86, _87, _88, _89 would be _8589.
Is there a way I can automate this in Stata? I wondered whether I could reshape the data and try and summarise in a different manner.
Code:
clear input str11 ons_ccg_code int(_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15 _16 _17 _18 _19) "E38000056" 982 1100 1103 1150 1135 1034 1124 1156 1161 1104 1091 1071 1086 1040 1050 1113 1192 1161 1138 805 "E38000068" 792 818 828 871 860 825 815 885 829 895 806 753 700 696 696 779 812 765 727 688 "E38000091" 1063 941 994 999 1022 973 910 921 930 920 899 784 819 782 861 915 917 971 935 935 "E38000101" 3062 2940 2850 2990 2838 2683 2684 2595 2568 2465 2271 2242 2213 2144 2303 2349 2475 2544 3024 4516 "E38000151" 963 976 1018 1082 1011 1096 1073 1178 1074 1101 1000 1037 961 982 950 998 1080 1124 1140 1028 end
Comment