Stata Basics 7: Create categorical var from continuous var recode(English version)

Опубликовано: 25 Июль 2026
на канале: Dr. Bob Wen (Stata, Economics, Econometrics)
6,518
63

Stata command recode can convert a continuous variable to a categorical variable according to the rules specified.

The commands in the video:
***************
* recode ****
***************
set more off

webuse nlsw88.dta, clear

summarize grade

recode grade (0/11=1) (12=2) (13/15=3) (16=4) (17/18=5), generate(edu)

tabulate edu

recode grade (0/11=1 "LessHi") (12=2 "HighSc") (13/15=3 "SomeColle") (16=4 "BacheDeg") (17/18=5 "GradDeg"), generate(edu2)

tabulate edu2

codebook married

recode grade (0/11=1 "LessHi") (12=2 "HighSc") (13/15=3 "SomeColle") (16=4 "BacheDeg") (17/18=5 "GradDeg") if married==1, generate(edu3)

codebook edu3

【Free Courses on My YouTube Channel】

Economics in Real Life:
   • Economics in Real Life  

Solutions to Introductory Econometrics A Modern Approach 7th Edition:
   • Solutions to Introductory Econometrics A M...  

Solutions to Microeconomics Theory and Applications with Calculus:
   • Solutions to Microeconomics Theory and App...  

Stata Tutorials:
   • Stata Tutorials  

Five Minute Econometrics (Econometrics Tutorials):
   • Five Minute Econometrics (Econometrics Tut...  

Introductory Microeconomics:
   • Introductory Microeconomics (2022)  

Introductory Stata:
   • Introductory Stata (2022)  

Drum Covers:
   • Drum Covers|流行歌曲電子鼓  

【粵語Cantonese】現實生活中的經濟學:
   • 【Cantonese粵語】現實生活中的經濟學  

【國語Mandarin】現實生活中的經濟學:
   • 【Mandarin國語】現實生活中的經濟學  

【粵語Cantonese】微觀經濟學基礎:
   • 粵語Cantonese微觀經濟學基礎2022  

【粵語Cantonese】五分鐘計量經濟學:
   • 【Cantonese粵語】五分鐘計量經濟學(計量經濟學輔導)  

【國語Mandarin】五分鐘計量經濟學:
   • 【Mandarin國語】五分鐘計量經濟學(計量經濟學輔導)  

On the Road:
   • On the Road  

【Become a Supporter/Member of the channel ($2.99) to get PDF transcripts for】
1. Solutions to Microeconomics Theory and Applications with Calculus 5th Edition,
2. Solutions to Introductory Econometrics A Modern Approach 7th Edition,
3. Introductory Stata (2022),
4. Introductory Microeconomics (2022), and
5. Introductory Stata: Summary Statistics and Data Management
   / @bobwenecon  

In addition to the videos on my YouTube channel, you can also learn Stata from my free Alison online courses.

Introductory Stata: Summary Statistics and Data Management
https://alison.com/course/introductor...

Introductory Stata: Graphics and Data Visualization
https://alison.com/course/introductor...