DATAB Part 2: Creating a person-year table
Quote from Eric Grant on 04/17/2025, 9:41 amDatab Part 2: Creating a person-year table.
This tutorial uses the study introduced in Part 1 to create a simple person-year table based on a subjects’ “year in”, “year out”, and “case status”. We create 5-year age categories and accumulate person-years and case counts into each stratum.
The mp4 file is the 10 minute tutorial.
The graphics file (.pdf) is attached. The script and logs are below:
DATAB Script:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DATAB tutorial 2! Create a cross-tabulated dataset based on the “How DATAB Works” tutorial! Output files: tutorial_2_tab.bsf (binary file)! tutorial_2_tab.csv @!!! HIROSOFT INTERNATIONAL LLC! August 2024!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DATAB is a program to take individual records (persons) and! count their accumulated person-years into categories! that we define!! In this example, we will count person years and events to create rates! The data that we will used is based on Slide 8 of the accompanying! online tutorial. See: https://hirosoft.com/forum/topic/tutorial-datab-part-1/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! To use DATAB, we define variables! We then define categories to stratify the data in the variables! Finally, we input the data. DATAB will then accumulate person years! and count events into each of the categories that we defined.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! On the graphic in the accompanying tutorial, we see that there are! 6 individuals in the study. Their age is the primary time category! The study design starts at age 50 and ends at age 80.! All person-time prior to age 50 or after age 80 is censored!! The input data includes the following variables! ID: An arbitrary ID value, here we use 1-6! Age_in: A participant’s age when they come under surveillance! Age_out: A particpant’s age when they left the study! Case: If they had the event at the time they left, this value is 1, else 0!! We begin by telling Epicure that we are starting a new project (i.e. clears! the memory) and also that this is a DATAB session. The DATAB module will! read individual records and create a stratified person-year table and event! counts. Each command in Epicure is terminated with the ampersand “@”new datab @! We start by defining the variables that we will use! using the NAMES command. Note, these are just variable names (placeholders)! at this time. We will define categories using these variables, finally,! we will input the data for these variable namesNAMES id age_in age_out case @! now we define other information that DATAB needs! Let’s start with a 5-year age categories from! age 50 to age 80 (like the graphic). We use the! DURATION command for ages that are not based on! birth years and calendar date (we’ll see an example! based on calendar dates in the next tutorial).DURATION age_cat50 (5) 80@! Next we tell DATAB which variable is the entry ageENTRY age_in @! Exit age:EXIT age_out @! Tell DATAB which variable indicates an EventEVENT case @! This is sufficient information for DATAB to compute! person-years in 5-year time intervals and count events! in each strata!! We are now ready to input the data using the INPUT! command. Usually, we will read the data from a file but for! this example, the data will be input directly from! this script. Remember the variables are defined as:!! ID: An arbitrary ID value, here we use 1-6! Age_in: A participant’s age when they come under surveillance! Age_out: A particpant’s age when they left the study! Case: If they had the event at the time they left, this value is 1, else 0!! We will not retype the variable names, simply the data separated by spaces.! there are 4 variables. Each number will be put into the next variable, when the! end of the list is found, it will repeat (the linefeeds are there for clarity).INPUT < @1 52 76 12 58 80 03 50 64 04 50 68 15 50 63 06 56 78 1@! At this point, the person-year table has been created! Three variables were created based on our definitions! PYR: person year in the strata! age_cat: The age stratification we defined (5-year categories; age 50-80)! case: a count of the number of cases in each strata!! another variable was created by DATAB “AT_RISK”sum case @sum pyr @sum pyr by age_cat @tran rate = case/pyr @mean rate by age_cat @!! Save the data to a CSV fileDATA TO tutorial_2_tab.csv @!! Save the data to a binary “BSF” filesave; as tutorial_2_tab @Log file:[
Epicure/DATAB Version 2.00.04 (Oct 2023)Gambarimashoo!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DATAB tutorial 2! Create a cross-tabulated dataset based on the “How DATAB Works” tutorial! Output files: tutorial_2_tab.bsf (binary file)! tutorial_2_tab.csv @!!! HIROSOFT INTERNATIONAL LLC! August 2024!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DATAB is a program to take individual records (persons) and! count their accumulated person-years into categories! that we define!! In this example, we will count person years and events to create rates! The data that we will used is based on Slide 8 of the accompanying! online tutorial. See: https://hirosoft.com/forum/topic/tutorial-datab-part-1/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! To use DATAB, we define variables! We then define categories to stratify the data in the variables! Finally, we input the data. DATAB will then accumulate person years! and count events into each of the categories that we defined.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! On the graphic in the accompanying tutorial, we see that there are! 6 individuals in the study. Their age is the primary time category! The study design starts at age 50 and ends at age 80.! All person-time prior to age 50 or after age 80 is censored!! The input data includes the following variables! ID: An arbitrary ID value, here we use 1-6! Age_in: A participant’s age when they come under surveillance! Age_out: A particpant’s age when they left the study! Case: If they had the event at the time they left, this value is 1, else 0!! We begin by telling Epicure that we are starting a new project (i.e. clears! the memory) and also that this is a DATAB session. The DATAB module will! read individual records and create a stratified person-year table and event! counts. Each command in Epicure is terminated with the ampersand “@”new datab @! We start by defining the variables that we will use! using the NAMES command. Note, these are just variable names (placeholders)! at this time. We will define categories using these variables, finally,! we will input the data for these variable namesNAMES id age_in age_out case @! now we define other information that DATAB needs! Let’s start with a 5-year age categories from! age 50 to age 80 (like the graphic). We use the! DURATION command for ages that are not based on! birth years and calendar date (we’ll see an example! based on calendar dates in the next tutorial).DURATION age_cat50 (5) 80@! Next we tell DATAB which variable is the entry ageENTRY age_in @! Exit age:EXIT age_out @! Tell DATAB which variable indicates an EventEVENT case @! This is sufficient information for DATAB to compute! person-years in 5-year time intervals and count events! in each strata!! We are now ready to input the data using the INPUT! command. Usually, we will read the data from a file but for! this example, the data will be input directly from! this script. Remember the variables are defined as:!! ID: An arbitrary ID value, here we use 1-6! Age_in: A participant’s age when they come under surveillance! Age_out: A particpant’s age when they left the study! Case: If they had the event at the time they left, this value is 1, else 0!! We will not retype the variable names, simply the data separated by spaces.! there are 4 variables. Each number will be put into the next variable, when the! end of the list is found, it will repeat (the linefeeds are there for clarity).INPUT < @Description of table:Variable Category Lower UpperNumber Name Number Name Bound Bound1 age_cat1 50 – 55 [ 50.00 55.00 )2 55 – 60 [ 55.00 60.00 )3 60 – 65 [ 60.00 65.00 )4 65 – 70 [ 65.00 70.00 )5 70 – 75 [ 70.00 75.00 )6 75 – 80 [ 75.00 80.00 )Summary Variables1) AT_RISK 2) PYR 3) caseThe potential number of cells is 6Records read — 6 Records used — 6This table contains data in 6 with 6 variables! At this point, the person-year table has been created! Three variables were created based on our definitions! PYR: person year in the strata! age_cat: The age stratification we defined (5-year categories; age 50-80)! case: a count of the number of cases in each strata!! another variable was created by DATAB “AT_RISK”sum case @Summary for caseSum Count Minimum Maximum3 6 0 2sum pyr @Summary for PYRSum Count Minimum Maximum113 6 9 27sum pyr by age_cat @Summary for PYRage_cat Sum Count Minimum Maximum1 18 1 18 182 26 1 26 263 27 1 27 274 18 1 18 185 15 1 15 156 9 1 9 9tran rate = case/pyr @mean rate by age_cat @Summary for rateage_cat Mean Std. Dev. Count Minimum Maximum1 0 0 1 0 02 0 0 1 0 03 0 0 1 0 04 0.0555556 0 1 0.055556 0.0555565 0 0 1 0 06 0.222222 0 1 0.22222 0.22222!! Save the data to a CSV fileDATA TO tutorial_2_tab.csv @6 records written to tutorial_2_tab.csv!! Save the data to a binary “BSF” filesave; as tutorial_2_tab @6 records written to tutorial_2_tab.BSF]
Datab Part 2: Creating a person-year table.
This tutorial uses the study introduced in Part 1 to create a simple person-year table based on a subjects’ “year in”, “year out”, and “case status”. We create 5-year age categories and accumulate person-years and case counts into each stratum.
The mp4 file is the 10 minute tutorial.
The graphics file (.pdf) is attached. The script and logs are below:
DATAB Script:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DATAB tutorial 2! Create a cross-tabulated dataset based on the “How DATAB Works” tutorial! Output files: tutorial_2_tab.bsf (binary file)! tutorial_2_tab.csv @!!! HIROSOFT INTERNATIONAL LLC! August 2024!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DATAB is a program to take individual records (persons) and! count their accumulated person-years into categories! that we define!! In this example, we will count person years and events to create rates! The data that we will used is based on Slide 8 of the accompanying! online tutorial. See: https://hirosoft.com/forum/topic/tutorial-datab-part-1/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! To use DATAB, we define variables! We then define categories to stratify the data in the variables! Finally, we input the data. DATAB will then accumulate person years! and count events into each of the categories that we defined.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! On the graphic in the accompanying tutorial, we see that there are! 6 individuals in the study. Their age is the primary time category! The study design starts at age 50 and ends at age 80.! All person-time prior to age 50 or after age 80 is censored!! The input data includes the following variables! ID: An arbitrary ID value, here we use 1-6! Age_in: A participant’s age when they come under surveillance! Age_out: A particpant’s age when they left the study! Case: If they had the event at the time they left, this value is 1, else 0!! We begin by telling Epicure that we are starting a new project (i.e. clears! the memory) and also that this is a DATAB session. The DATAB module will! read individual records and create a stratified person-year table and event! counts. Each command in Epicure is terminated with the ampersand “@”new datab @! We start by defining the variables that we will use! using the NAMES command. Note, these are just variable names (placeholders)! at this time. We will define categories using these variables, finally,! we will input the data for these variable namesNAMES id age_in age_out case @! now we define other information that DATAB needs! Let’s start with a 5-year age categories from! age 50 to age 80 (like the graphic). We use the! DURATION command for ages that are not based on! birth years and calendar date (we’ll see an example! based on calendar dates in the next tutorial).DURATION age_cat50 (5) 80@! Next we tell DATAB which variable is the entry ageENTRY age_in @! Exit age:EXIT age_out @! Tell DATAB which variable indicates an EventEVENT case @! This is sufficient information for DATAB to compute! person-years in 5-year time intervals and count events! in each strata!! We are now ready to input the data using the INPUT! command. Usually, we will read the data from a file but for! this example, the data will be input directly from! this script. Remember the variables are defined as:!! ID: An arbitrary ID value, here we use 1-6! Age_in: A participant’s age when they come under surveillance! Age_out: A particpant’s age when they left the study! Case: If they had the event at the time they left, this value is 1, else 0!! We will not retype the variable names, simply the data separated by spaces.! there are 4 variables. Each number will be put into the next variable, when the! end of the list is found, it will repeat (the linefeeds are there for clarity).INPUT < @1 52 76 12 58 80 03 50 64 04 50 68 15 50 63 06 56 78 1@! At this point, the person-year table has been created! Three variables were created based on our definitions! PYR: person year in the strata! age_cat: The age stratification we defined (5-year categories; age 50-80)! case: a count of the number of cases in each strata!! another variable was created by DATAB “AT_RISK”sum case @sum pyr @sum pyr by age_cat @tran rate = case/pyr @mean rate by age_cat @!! Save the data to a CSV fileDATA TO tutorial_2_tab.csv @!! Save the data to a binary “BSF” filesave; as tutorial_2_tab @
Uploaded files:[
Epicure/DATAB Version 2.00.04 (Oct 2023)Gambarimashoo!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DATAB tutorial 2! Create a cross-tabulated dataset based on the “How DATAB Works” tutorial! Output files: tutorial_2_tab.bsf (binary file)! tutorial_2_tab.csv @!!! HIROSOFT INTERNATIONAL LLC! August 2024!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DATAB is a program to take individual records (persons) and! count their accumulated person-years into categories! that we define!! In this example, we will count person years and events to create rates! The data that we will used is based on Slide 8 of the accompanying! online tutorial. See: https://hirosoft.com/forum/topic/tutorial-datab-part-1/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! To use DATAB, we define variables! We then define categories to stratify the data in the variables! Finally, we input the data. DATAB will then accumulate person years! and count events into each of the categories that we defined.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! On the graphic in the accompanying tutorial, we see that there are! 6 individuals in the study. Their age is the primary time category! The study design starts at age 50 and ends at age 80.! All person-time prior to age 50 or after age 80 is censored!! The input data includes the following variables! ID: An arbitrary ID value, here we use 1-6! Age_in: A participant’s age when they come under surveillance! Age_out: A particpant’s age when they left the study! Case: If they had the event at the time they left, this value is 1, else 0!! We begin by telling Epicure that we are starting a new project (i.e. clears! the memory) and also that this is a DATAB session. The DATAB module will! read individual records and create a stratified person-year table and event! counts. Each command in Epicure is terminated with the ampersand “@”new datab @! We start by defining the variables that we will use! using the NAMES command. Note, these are just variable names (placeholders)! at this time. We will define categories using these variables, finally,! we will input the data for these variable namesNAMES id age_in age_out case @! now we define other information that DATAB needs! Let’s start with a 5-year age categories from! age 50 to age 80 (like the graphic). We use the! DURATION command for ages that are not based on! birth years and calendar date (we’ll see an example! based on calendar dates in the next tutorial).DURATION age_cat50 (5) 80@! Next we tell DATAB which variable is the entry ageENTRY age_in @! Exit age:EXIT age_out @! Tell DATAB which variable indicates an EventEVENT case @! This is sufficient information for DATAB to compute! person-years in 5-year time intervals and count events! in each strata!! We are now ready to input the data using the INPUT! command. Usually, we will read the data from a file but for! this example, the data will be input directly from! this script. Remember the variables are defined as:!! ID: An arbitrary ID value, here we use 1-6! Age_in: A participant’s age when they come under surveillance! Age_out: A particpant’s age when they left the study! Case: If they had the event at the time they left, this value is 1, else 0!! We will not retype the variable names, simply the data separated by spaces.! there are 4 variables. Each number will be put into the next variable, when the! end of the list is found, it will repeat (the linefeeds are there for clarity).INPUT < @Description of table:Variable Category Lower UpperNumber Name Number Name Bound Bound1 age_cat1 50 – 55 [ 50.00 55.00 )2 55 – 60 [ 55.00 60.00 )3 60 – 65 [ 60.00 65.00 )4 65 – 70 [ 65.00 70.00 )5 70 – 75 [ 70.00 75.00 )6 75 – 80 [ 75.00 80.00 )Summary Variables1) AT_RISK 2) PYR 3) caseThe potential number of cells is 6Records read — 6 Records used — 6This table contains data in 6 with 6 variables! At this point, the person-year table has been created! Three variables were created based on our definitions! PYR: person year in the strata! age_cat: The age stratification we defined (5-year categories; age 50-80)! case: a count of the number of cases in each strata!! another variable was created by DATAB “AT_RISK”sum case @Summary for caseSum Count Minimum Maximum3 6 0 2sum pyr @Summary for PYRSum Count Minimum Maximum113 6 9 27sum pyr by age_cat @Summary for PYRage_cat Sum Count Minimum Maximum1 18 1 18 182 26 1 26 263 27 1 27 274 18 1 18 185 15 1 15 156 9 1 9 9tran rate = case/pyr @mean rate by age_cat @Summary for rateage_cat Mean Std. Dev. Count Minimum Maximum1 0 0 1 0 02 0 0 1 0 03 0 0 1 0 04 0.0555556 0 1 0.055556 0.0555565 0 0 1 0 06 0.222222 0 1 0.22222 0.22222!! Save the data to a CSV fileDATA TO tutorial_2_tab.csv @6 records written to tutorial_2_tab.csv!! Save the data to a binary “BSF” filesave; as tutorial_2_tab @6 records written to tutorial_2_tab.BSF]
