You are on page 1of 4

/// Here is the commands for the exercise/// 

1. list in 1 

2. list income in 1 

3. list in - 1 

4. list in 11/16 

5. list income 

6. list priceofteff in 5/10 

7. list price of teff in 5/10,sum mean 

8. list in -5/-1 

9. list priceofteff if priceofteff <0 

10. list if income >1000 

11. list income if income <2000 

12. list income if consumption >2000

 13. list if sex==2 & income > 1500

 14. list if income ==. 

15. list if price<0 

16. list if employed==1 age >40 

17. list if sex ==1 & income >2000 & employed ==1 

18. list sex employed region income if sex==1 & region ==1 & income >2000
& employed==1 

19. list sex employed region income if sex==1 & income >2000 &
employed==1 & region ==1 region==2 

20. list numbofindividu if region ==1 & region ==2 


21. tab sex 

22. sum income 

23. tab sex employed 

24. tab sex in 1/5 

25. tab sex if employed ==1 

26. sum consumption

27. tab employed if consumption > 5029 

28. tab region, sum(consumption) 

29. sum income if region==1 | region ==2

 30. sum income consumption priceofteff 

31. sum income, detail 

32. tabstat income consumption, stats(mean median sd count max min variance
kurtosis skewness) 

33. edit sex if sex==1 

34. browse sex if sex==1 

35. inspect price ///another option for missing data/// list if priceofteff=s. 

36. codebook income 

37. replace priceofteff=1000 if priceofteff<0 

38. list price in 4 

39. replace priceofteff=-2000 in 4 /// to see the change occur/// list price in 4 

40. replace priceofteff=1000 in 4 list price in 4 

41. count if sex==1 & employed==1 

42. count if sex ==1 & income>1500 

43. rename priceofteff price 


44. rename consumption cons 

45. rename numbofindividu Family_size 

46. rename ageofhhhead age 

47. label variable hhid "Household code" 

48. label variable number of independent "family size" 

49. label variable age "age of the household head"

50. tab sex

51. recode sex 1=0 2=1 

52 ///repetition/// 

53. tab employed 

54. recode employed 2=11=0 

55. tab employed /// to see change/// 

56. label define sex 1"male" O"female" label value sex sex///2nd step/// tab sex ///3rd step
in labelling var/// 

57. label define employed 1"private" O"public" label value employed employed /// 2nd
step/// tab employed /// 3rd step to see the output/// 

58. label define satisfactionrate 1"Not satisfied" 2"satisfied" 3"very satisfied" label value
satisfactionrate satisfactionrate tab satisfactionrate 

59. label define region 1 "Tigray" 2"Amhara" 3"Oromia" 4"SNNP" label value region
region 

60. tab region 

61. browse region 

62. browse 

63. tab region satisfactionrate 

64. gen age2=age 2 

65. gen savin = income-cons 


66. gen sati = satisfactionrate label define sati 1"satisfied" 0"not satisfied" /// 2nd step///
label value sati sati 

67. gen Price_inf = price>1000///enter// label define Price_inf 1"high_price"


O"Fair_price"//enter// label value Price_inf Price_inf //enter// 

68. gen PCI = income / Family size

69. gen socialstatus = PCI>1000 

70. gen hapdummy = happiness>5 

71. gen IW = hapdummy==1 & socialstatus ==1 ///enter/// label define socialstatus
1"Rich" O"poor" /// enter/// label value socialstatus socialstatus /// enter/// 

72. tab region, gen(kilil) 

73. egen AP = mean(price) egen AC = mean(cons)//since it is two question// 

74. egen APR = mean(price), by (region) egen ACR = mean(cons), by (region)//two


question// 

75. egen TCR = sum(cons), by (region) 

76. count if cons> ACR 77. replace price =1740 if price>5000 

78. gen Ddfemale = cons if sex==0& region ==1 

79. xtile CC = cons, nq(3)//enter// label define CC 1 "low" 2"medium" 3"high" //


enter// label value CC CC // enter//

You might also like