Dear All,
I am trying to create a weekly number for a sample of companies with weekly date (wdate) covering the weeks from Jan 4, 2020 to March 19, 2022 for a sample of 73 countries. For example, week number for the first week, i.e. Jan 4, 2020, is 0, for the second week Jan 11, 2020 is 2, for the third week Jan 18, 2020 is 3 and so on (please see the data below covering 4 countries). Could you please provide me with some feedback on how to to create a weekly number variable that can simply add a week number for each week across countries and years? Thank you.
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
I am trying to create a weekly number for a sample of companies with weekly date (wdate) covering the weeks from Jan 4, 2020 to March 19, 2022 for a sample of 73 countries. For example, week number for the first week, i.e. Jan 4, 2020, is 0, for the second week Jan 11, 2020 is 2, for the third week Jan 18, 2020 is 3 and so on (please see the data below covering 4 countries). Could you please provide me with some feedback on how to to create a weekly number variable that can simply add a week number for each week across countries and years? Thank you.
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str56 countryname float wdate "Argentina" 21918 "Argentina" 21925 "Argentina" 21932 "Argentina" 21939 "Argentina" 21946 "Argentina" 21953 "Argentina" 21960 "Argentina" 21967 "Argentina" 21974 "Argentina" 21981 "Argentina" 21988 "Argentina" 21995 "Argentina" 22002 "Argentina" 22009 "Argentina" 22016 "Argentina" 22023 "Argentina" 22030 "Argentina" 22037 "Argentina" 22044 "Argentina" 22051 "Argentina" 22058 "Argentina" 22065 "Argentina" 22072 "Argentina" 22079 "Argentina" 22086 "Argentina" 22093 "Argentina" 22100 "Argentina" 22107 "Argentina" 22114 "Argentina" 22121 "Argentina" 22128 "Argentina" 22135 "Argentina" 22142 "Argentina" 22149 "Argentina" 22156 "Argentina" 22163 "Argentina" 22170 "Argentina" 22177 "Argentina" 22184 "Argentina" 22191 "Argentina" 22198 "Argentina" 22205 "Argentina" 22212 "Argentina" 22219 "Argentina" 22226 "Argentina" 22233 "Argentina" 22240 "Argentina" 22247 "Argentina" 22254 "Argentina" 22261 "Argentina" 22268 "Argentina" 22275 "Argentina" 22282 "Argentina" 22289 "Argentina" 22296 "Argentina" 22303 "Argentina" 22310 "Argentina" 22317 "Argentina" 22324 "Argentina" 22331 "Argentina" 22338 "Argentina" 22345 "Argentina" 22352 "Argentina" 22359 "Argentina" 22366 "Argentina" 22373 "Argentina" 22380 "Argentina" 22387 "Argentina" 22394 "Argentina" 22401 "Argentina" 22408 "Argentina" 22415 "Argentina" 22422 "Argentina" 22429 "Argentina" 22436 "Argentina" 22443 "Argentina" 22450 "Argentina" 22457 "Argentina" 22464 "Argentina" 22471 "Argentina" 22478 "Argentina" 22485 "Argentina" 22492 "Argentina" 22499 "Argentina" 22506 "Argentina" 22513 "Argentina" 22520 "Argentina" 22527 "Argentina" 22534 "Argentina" 22541 "Argentina" 22548 "Argentina" 22555 "Argentina" 22562 "Argentina" 22569 "Argentina" 22576 "Argentina" 22583 "Argentina" 22590 "Argentina" 22597 "Argentina" 22604 "Argentina" 22611 "Argentina" 22618 "Argentina" 22625 "Argentina" 22632 "Argentina" 22639 "Argentina" 22646 "Argentina" 22653 "Argentina" 22660 "Argentina" 22667 "Argentina" 22674 "Argentina" 22681 "Argentina" 22688 "Argentina" 22695 "Argentina" 22702 "Argentina" 22709 "Argentina" 22716 "Argentina" 22723 "Australia" 21918 "Australia" 21925 "Australia" 21932 "Australia" 21939 "Australia" 21946 "Australia" 21953 "Australia" 21960 "Australia" 21967 "Australia" 21974 "Australia" 21981 "Australia" 21988 "Australia" 21995 "Australia" 22002 "Australia" 22009 "Australia" 22016 "Australia" 22023 "Australia" 22030 "Australia" 22037 "Australia" 22044 "Australia" 22051 "Australia" 22058 "Australia" 22065 "Australia" 22072 "Australia" 22079 "Australia" 22086 "Australia" 22093 "Australia" 22100 "Australia" 22107 "Australia" 22114 "Australia" 22121 "Australia" 22128 "Australia" 22135 "Australia" 22142 "Australia" 22149 "Australia" 22156 "Australia" 22163 "Australia" 22170 "Australia" 22177 "Australia" 22184 "Australia" 22191 "Australia" 22198 "Australia" 22205 "Australia" 22212 "Australia" 22219 "Australia" 22226 "Australia" 22233 "Australia" 22240 "Australia" 22247 "Australia" 22254 "Australia" 22261 "Australia" 22268 "Australia" 22275 "Australia" 22282 "Australia" 22289 "Australia" 22296 "Australia" 22303 "Australia" 22310 "Australia" 22317 "Australia" 22324 "Australia" 22331 "Australia" 22338 "Australia" 22345 "Australia" 22352 "Australia" 22359 "Australia" 22366 "Australia" 22373 "Australia" 22380 "Australia" 22387 "Australia" 22394 "Australia" 22401 "Australia" 22408 "Australia" 22415 "Australia" 22422 "Australia" 22429 "Australia" 22436 "Australia" 22443 "Australia" 22450 "Australia" 22457 "Australia" 22464 "Australia" 22471 "Australia" 22478 "Australia" 22485 "Australia" 22492 "Australia" 22499 "Australia" 22506 "Australia" 22513 "Australia" 22520 "Australia" 22527 "Australia" 22534 "Australia" 22541 "Australia" 22548 "Australia" 22555 "Australia" 22562 "Australia" 22569 "Australia" 22576 "Australia" 22583 "Australia" 22590 "Australia" 22597 "Australia" 22604 "Australia" 22611 "Australia" 22618 "Australia" 22625 "Australia" 22632 "Australia" 22639 "Australia" 22646 "Australia" 22653 "Australia" 22660 "Australia" 22667 "Australia" 22674 "Australia" 22681 "Australia" 22688 "Australia" 22695 "Australia" 22702 "Australia" 22709 "Australia" 22716 "Australia" 22723 "Austria" 21918 "Austria" 21925 "Austria" 21932 "Austria" 21939 "Austria" 21946 "Austria" 21953 "Austria" 21960 "Austria" 21967 "Austria" 21974 "Austria" 21981 "Austria" 21988 "Austria" 21995 "Austria" 22002 "Austria" 22009 "Austria" 22016 "Austria" 22023 "Austria" 22030 "Austria" 22037 "Austria" 22044 "Austria" 22051 "Austria" 22058 "Austria" 22065 "Austria" 22072 "Austria" 22079 "Austria" 22086 "Austria" 22093 "Austria" 22100 "Austria" 22107 "Austria" 22114 "Austria" 22121 "Austria" 22128 "Austria" 22135 "Austria" 22142 "Austria" 22149 "Austria" 22156 "Austria" 22163 "Austria" 22170 "Austria" 22177 "Austria" 22184 "Austria" 22191 "Austria" 22198 "Austria" 22205 "Austria" 22212 "Austria" 22219 "Austria" 22226 "Austria" 22233 "Austria" 22240 "Austria" 22247 "Austria" 22254 "Austria" 22261 "Austria" 22268 "Austria" 22275 "Austria" 22282 "Austria" 22289 "Austria" 22296 "Austria" 22303 "Austria" 22310 "Austria" 22317 "Austria" 22324 "Austria" 22331 "Austria" 22338 "Austria" 22345 "Austria" 22352 "Austria" 22359 "Austria" 22366 "Austria" 22373 "Austria" 22380 "Austria" 22387 "Austria" 22394 "Austria" 22401 "Austria" 22408 "Austria" 22415 "Austria" 22422 "Austria" 22429 "Austria" 22436 "Austria" 22443 "Austria" 22450 "Austria" 22457 "Austria" 22464 "Austria" 22471 "Austria" 22478 "Austria" 22485 "Austria" 22492 "Austria" 22499 "Austria" 22506 "Austria" 22513 "Austria" 22520 "Austria" 22527 "Austria" 22534 "Austria" 22541 "Austria" 22548 "Austria" 22555 "Austria" 22562 "Austria" 22569 "Austria" 22576 "Austria" 22583 "Austria" 22590 "Austria" 22597 "Austria" 22604 "Austria" 22611 "Austria" 22618 "Austria" 22625 "Austria" 22632 "Austria" 22639 "Austria" 22646 "Austria" 22653 "Austria" 22660 "Austria" 22667 "Austria" 22674 "Austria" 22681 "Austria" 22688 "Austria" 22695 "Austria" 22702 "Austria" 22709 "Austria" 22716 "Austria" 22723 "Bangladesh" 21918 "Bangladesh" 21925 "Bangladesh" 21932 "Bangladesh" 21939 "Bangladesh" 21946 "Bangladesh" 21953 "Bangladesh" 21960 "Bangladesh" 21967 "Bangladesh" 21974 "Bangladesh" 21981 "Bangladesh" 21988 "Bangladesh" 21995 "Bangladesh" 22002 "Bangladesh" 22009 "Bangladesh" 22016 "Bangladesh" 22023 "Bangladesh" 22030 "Bangladesh" 22037 "Bangladesh" 22044 "Bangladesh" 22051 "Bangladesh" 22058 "Bangladesh" 22065 "Bangladesh" 22072 "Bangladesh" 22079 "Bangladesh" 22086 "Bangladesh" 22093 "Bangladesh" 22100 "Bangladesh" 22107 "Bangladesh" 22114 "Bangladesh" 22121 "Bangladesh" 22128 "Bangladesh" 22135 "Bangladesh" 22142 "Bangladesh" 22149 "Bangladesh" 22156 "Bangladesh" 22163 "Bangladesh" 22170 "Bangladesh" 22177 "Bangladesh" 22184 "Bangladesh" 22191 "Bangladesh" 22198 "Bangladesh" 22205 "Bangladesh" 22212 "Bangladesh" 22219 "Bangladesh" 22226 "Bangladesh" 22233 "Bangladesh" 22240 "Bangladesh" 22247 "Bangladesh" 22254 "Bangladesh" 22261 "Bangladesh" 22268 "Bangladesh" 22275 "Bangladesh" 22282 "Bangladesh" 22289 "Bangladesh" 22296 "Bangladesh" 22303 "Bangladesh" 22310 "Bangladesh" 22317 "Bangladesh" 22324 "Bangladesh" 22331 "Bangladesh" 22338 "Bangladesh" 22345 "Bangladesh" 22352 "Bangladesh" 22359 "Bangladesh" 22366 "Bangladesh" 22373 "Bangladesh" 22380 "Bangladesh" 22387 "Bangladesh" 22394 "Bangladesh" 22401 "Bangladesh" 22408 "Bangladesh" 22415 "Bangladesh" 22422 "Bangladesh" 22429 "Bangladesh" 22436 "Bangladesh" 22443 "Bangladesh" 22450 "Bangladesh" 22457 "Bangladesh" 22464 "Bangladesh" 22471 "Bangladesh" 22478 "Bangladesh" 22485 "Bangladesh" 22492 "Bangladesh" 22499 "Bangladesh" 22506 "Bangladesh" 22513 "Bangladesh" 22520 "Bangladesh" 22527 "Bangladesh" 22534 "Bangladesh" 22541 "Bangladesh" 22548 "Bangladesh" 22555 "Bangladesh" 22562 "Bangladesh" 22569 "Bangladesh" 22576 "Bangladesh" 22583 "Bangladesh" 22590 "Bangladesh" 22597 "Bangladesh" 22604 "Bangladesh" 22611 "Bangladesh" 22618 "Bangladesh" 22625 "Bangladesh" 22632 "Bangladesh" 22639 "Bangladesh" 22646 "Bangladesh" 22653 "Bangladesh" 22660 "Bangladesh" 22667 "Bangladesh" 22674 "Bangladesh" 22681 "Bangladesh" 22688 "Bangladesh" 22695 "Bangladesh" 22702 "Bangladesh" 22709 "Bangladesh" 22716 "Bangladesh" 22723 end format %td wdate
Comment