@@ -269,7 +269,14 @@ tab age_q4, sum(age)
269269
270270* Expectedly, there is more variance in the last, older group. Let's finally get
271271* the range, or lower (min) and lower (max) bounds, of each age quartile.
272- table age_q4, c(min age max age)
272+ if c(version) < 17 {
273+ table age_q4, c(min age max age)
274+ }
275+ else {
276+ table age_q4, stat(min age) stat(max age)
277+ }
278+ * Note: the code above shows two different syntaxes. The former is for older
279+ * versions of Stata. The latter is for Stata 17 and above.
273280
274281* Recode to four age groups. The -irecode- command creates categories based on
275282* continuous intervals: category 0 of age4 will contain observations of age up
@@ -278,7 +285,12 @@ gen age4:age4 = irecode(age, 33, 49, 64, .)
278285
279286* Check the results. This is a different -table- command than the -tab- one used
280287* previously, which we will get to use for more flexible crosstabulations.
281- table age4, c(min age max age)
288+ if c(version) < 17 {
289+ table age4, c(min age max age)
290+ }
291+ else {
292+ table age4, stat(min age) stat(max age)
293+ }
282294
283295* And here's yet another way to crosstabulate: the -tab- command with the -sum-
284296* option returns the average age in each age group, along with the SD and count.
0 commit comments