Hello, I want to have week number 1-4 in a dataset having days. I appreciate help since I am getting pretty tired of it. Thank you anyone! data have; input id visit daynumber dayname $3. x; cards; 1 1 1 Mon 20 1 1 2 Tue 30 1 1 3 Wed 0 1 1 4 Thu 2 1 1 5 Fri 4 1 1 6 Sat 60 1 1 7 Sun 20 1 1 1 Mon 2 1 1 2 Tue 3 1 1 3 Wed 20 1 1 4 Thu 20 1 1 5 Fri 40 1 1 6 Sat 6 1 1 7 Sun 2 1 1 1 Mon 50 1 1 2 Tue 6 1 1 3 Wed 9 1 1 4 Thu 9 1 1 5 Fri 8 1 1 6 Sat 8 1 1 7 Sun 2 1 1 1 Mon 7 1 1 2 Tue 3 1 1 3 Wed 90 1 1 4 Thu 6 1 1 5 Fri 9 1 1 6 Sat 6 1 1 7 Sun 4 1 2 1 Mon 30 1 2 2 Tue 30 1 2 3 Wed 0 1 2 4 Thu 2 1 2 5 Fri 40 1 2 6 Sat 10 1 2 7 Sun 10 1 2 1 Mon 60 1 2 2 Tue 3 1 2 3 Wed 1 1 2 4 Thu 5 1 2 5 Fri 50 1 2 6 Sat 1 1 2 7 Sun 1 ; data want; input id visit daynumber dayname $3. x weeknumber; cards; 1 1 1 Mon 20 1 1 1 2 Tue 30 1 1 1 3 Wed 0 1 1 1 4 Thu 2 1 1 1 5 Fri 4 1 1 1 6 Sat 60 1 1 1 7 Sun 20 1 1 1 1 Mon 2 2 1 1 2 Tue 3 2 1 1 3 Wed 20 2 1 1 4 Thu 20 2 1 1 5 Fri 40 2 1 1 6 Sat 6 2 1 1 7 Sun 2 2 1 1 1 Mon 50 3 1 1 2 Tue 6 3 1 1 3 Wed 9 3 1 1 4 Thu 9 3 1 1 5 Fri 8 3 1 1 6 Sat 8 3 1 1 7 Sun 2 3 1 1 1 Mon 7 4 1 1 2 Tue 3 4 1 1 3 Wed 90 4 1 1 4 Thu 6 4 1 1 5 Fri 9 4 1 1 6 Sat 6 4 1 1 7 Sun 4 4 1 2 1 Mon 30 1 1 2 2 Tue 30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