{"id":29638972,"url":"https://github.com/andyphilips/mkduration","last_synced_at":"2026-02-05T08:01:54.954Z","repository":{"id":161310420,"uuid":"216110392","full_name":"andyphilips/mkduration","owner":"andyphilips","description":"Stata command to create duration variable with binary cross-sectional time series data","archived":false,"fork":false,"pushed_at":"2020-12-24T15:56:28.000Z","size":841,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-09T07:41:44.954Z","etag":null,"topics":["bcsts","duration-models","panel-data","stata"],"latest_commit_sha":null,"homepage":"","language":"Stata","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andyphilips.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-10-18T21:36:41.000Z","updated_at":"2021-11-01T15:36:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"0a641223-793f-4a9d-a5f9-969d445ffebe","html_url":"https://github.com/andyphilips/mkduration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andyphilips/mkduration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyphilips%2Fmkduration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyphilips%2Fmkduration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyphilips%2Fmkduration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyphilips%2Fmkduration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andyphilips","download_url":"https://codeload.github.com/andyphilips/mkduration/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyphilips%2Fmkduration/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29116450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bcsts","duration-models","panel-data","stata"],"created_at":"2025-07-21T20:07:51.016Z","updated_at":"2026-02-05T08:01:54.948Z","avatar_url":"https://github.com/andyphilips.png","language":"Stata","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mkduration\nStata command to create duration variable with binary cross-sectional time series data\n\n## Description\n`mkduration` is a Stata command to generate a duration variable for duration/event history data where the data are xtset and in long format. In other words, given CSTS-style data for i units observed over t time periods, and where there is some dichotomous variable (where \"1\" indicates the instance of an event, and \"0\" indicates an absence):\n\n| Unit | Time | Event |\n|------|------|-------|\n| 1    | 1    | 0     |\n| 1    | 2    | 0     |\n| 1    | 3    | 1     |\n| 1    | 4    | 0     |\n| 1    | 5    | 1     |\n| 2    | 1    | 0     |\n| 2    | 2    | 1     |\n| 2    | 3    | 0     |\n| 2    | 4    | 0     |\n| 2    | 5    | 0     |\n\n`mkduration` will generate a duration variable:\n\n| Unit | Time | Event | Duration |\n|------|------|-------|----------|\n| 1 | 1 | 0 | 1 |\n| 1 | 2 | 0 | 2 |\n| 1 | 3 | 1 | 3 |\n| 1 | 4 | 0 | 1 |\n| 1 | 5 | 1 | 2 |\n| 2 | 1 | 0 | 1 |\n| 2 | 2 | 1 | 2 |\n| 2 | 3 | 0 | 1 |\n| 2 | 4 | 0 | 2 |\n| 2 | 5 | 0 | 3 |\n\nMore information is available in the help file.\n\n## Examples and Citing\nYou can see more details in the [Stata Journal article](https://journals.sagepub.com/doi/10.1177/1536867X20976322), or the [ungated version](https://github.com/andyphilips/mkduration/blob/master/Philips-2020-SJ.pdf).\n\nIf you use `mkduration` in your own work, I'd love it if you cited me: \n* Philips, Andrew Q. 2020. \"An easy way to create duration variables in binary cross-sectional time series data.\" The Stata Journal 20(4): 916-930.\n\n\n## Install\nThe easiest way to install `mkduration` is by directly typing into Stata:\n```\nnet install st0621\nnet get st0621\n```\n\nAlternatively, you can install `mkduration` directly from GitHub if you're connected to the internet:\n```\ncapture ado uninstall mkduration\nnet install mkduration, from(https://github.com/andyphilips/mkduration/raw/master/src/)\n```\n\nLast, you can download the files from the source folder and either call directly to the .ado files or place them in your \"ado/plus/\" folder.\n\n## Version\nVersion 1.0.4, April 27, 2020\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyphilips%2Fmkduration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandyphilips%2Fmkduration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyphilips%2Fmkduration/lists"}