*NQUEST* *Formato id: 04_005_A capture split id, p(_) gen nquest = id1+id2 destring nquest, replace *Formato final id: 4005 *Variⷥl identificadora do digitador encode id3, gen (id4) rename id4 digitador drop id1 id2 id3 ********************CRIANDO BANCO SPOA************************** *mantendo somente 1 digitador (Bruna = 2): keep if digitador==2 *******Renomeando variⷥis ******** rename idade age rename IdadedoUltimoPeriodomenstrual age_last_period rename ensinofundamental years_of_edu rename ensinomdio years_of_edu_2 rename graduao years_of_edu_3 rename psgraduao years_of_edu_4 rename msdegree years_of_edu_5 rename doutorado years_of_edu_6 rename Q number_of_children rename T number_of_bedrooms rename U people_in_the_residence rename heart_disease_name___1 heart_attack rename heart_disease_name___2 heart_failure rename heart_disease_name___3 angina rename heart_disease_name___4 another_heart_disease rename lung_disease lung_disease rename Enfisemapulmonar lung_disease_name___1 rename Bronquite lung_disease_name___2 rename DPOC lung_disease_name___3 rename asma lung_disease_name___4 rename AQ cancer rename tipodecancer cancer_first_diagnosis rename AS family_history rename AT bypass rename AU hospit_over_24hs rename AV fall_last_year rename asesimnaanterior hip_fracture rename bsesimnaanterior hip_surgery rename csesimnaanterior surgery_by_sus rename AZ health_self_evalua rename BA chest_pain rename BB sleep_quality rename BC tiredness rename BD lack_of_interest rename BE depress_self_percp rename BF low_self_esteem rename BG raw_vegetable rename BH raw_veg_daily rename BI cooked_vegetable rename BJ cooked_veg_daily rename BK alcohol_intake rename BL alcohol_intake_freq rename BM alcohol_int_amount rename Homem alcohol_int_at_once_m rename Mulher alcohol_int_at_once_w rename BP alcohol_int_at_once_freq rename BQ current_smoking_status rename BR past_smoking_status rename BS physical_act_freq rename BT physical_act_diresp rename Caminhada physical_act_type___1 rename Ginastica physical_act_type___2 rename ArtesMarciais physical_act_type___3 rename Caminhadanaesteira physical_act_type___4 rename Hidroginastica physical_act_type___5 rename Ciclismo physical_act_type___6 rename Voleibol physical_act_type___7 rename Tenis physical_act_type___8 rename Corrida physical_act_type___9 rename GinasticaGeral physical_act_type___10 rename Alongamento physical_act_type___11 rename Futebol physical_act_type___12 rename Musculao physical_act_type___13 rename Natao physical_act_type___14 rename Basquete physical_act_type___15 rename Cambio physical_act_type___16 rename CK physical_act_history rename CL daily_tv_time rename CM daily_comp_time rename CN public_space_near_home rename CO public_space_structure rename professores program_teachers rename estagirios program_interns rename funcionriosserviosgerais program_employees rename CS weight_status rename CT stress_level rename CU stress_in_health rename CV sleep_hours rename testedecaminhada six_min_wt rename borgpre borg_pre rename borgpos borg_post rename gdsq1 gds_q1 rename gdsq2 gds_q2 rename gdsq3 gds_q3 rename gdsq4 gds_q4 rename gdsq5 gds_q5 rename gdsq6 gds_q6 rename gdsq7 gds_q7 rename gdsq8 gds_q8 rename gdsq9 gds_q9 rename gdsq10 gds_q10 rename gdsq11 gds_q11 rename gdsq12 gds_q12 rename gdsq13 gds_q13 rename gdsq14 gds_q14 rename gdsq15 gds_q15 rename capacidadefuncional functional_cap rename limitaoglobal global_lim rename aspectossociais social_aspc rename dor pain rename sademental mental_health rename vitalidade vitality rename complete visita_1_complete *******Eliminando variⷥis string e criando novas variⷥis********* **sex** encode sexo, gen (sex) //Feminino 1 //Maculino 2 destring, replace drop if nquest==1 encode sexo, gen(sex) move sex sexo //sex: feminino 1, masculino 2 **msdegree** encode mestrado, gen (msdegree) move msdegree mestrado drop mestrado **marital_status** gen marital_status=. recode marital_status .=1 if O=="nunca casei" recode marital_status .=2 if O=="casado(a)" recode marital_status .=3 if O=="viúvo(a)" recode marital_status .=4 if O=="divorciado(a)" move marital_status O drop O la def marital_status 1"nunca casei" 2"casado(a)" 3"viuvo(a)" 4"divorciado(a)" la val marital_status marital_status **children** encode P, gen (children) move children P label drop children recode children 1=0 recode children 2=1 drop P **skin_color** gen skin_color =. recode skind_color .=1 if R=="Branca" recode skin_color .=1 if R=="Branca" recode skin_color .=2 if R=="Preta" recode skin_color .=3 if R=="Indígena" recode skin_color .=4 if R=="Parda" recode skin_color .=5 if R=="Amarela" drop R **residence** encode S, gen (residence) label drop residence recode residence 1=2 2=1 drop S **family_income** gen family_income=. recode family_income .=1 if V=="até 2 SM" recode family_income .=2 if V=="2 a 4 SM" recode family_income .=3 if V=="4 a 10 SM" recode family_income .=4 if V=="10 a 20 SM" drop V **health_insurance** encode W, gen(health_insurance) move health_insurance W label drop health_insurance recode health_insurance 1=0 recode health_insurance 2=1 drop W **hipertension_diagnose** encode Y, gen (hipertension_diagnose) move hipertension_diagnose Y label drop hipertension_diagnose recode hipertension_diagnose 2=0 recode hipertension_diagnose 1=2 3=1 drop Y **hospit_due_hypertension** encode Z, gen (hospit_due_hypertension) move hospit_due_hypertension Z label drop hospit_due_hypertension recode hospit_due_hypertension 1=0 2=1 drop Z **diabetes_diagnose** encode AA, gen (diabetes_diagnose) move diabetes_diagnose AA label drop diabetes_diagnose recode diabetes_diagnose 4=1 recode diabetes_diagnose 3=0 drop AA **hospit_due_diabetes** encode AB, gen (hospit_due_diabetes) move hospit_due_diabetes AB label drop hospit_due_diabetes recode hospit_due_diabetes 2=1 1=0 drop AB **high_cholesterol** encode AC, gen(high_cholesterol) move high_cholesterol AC label drop high_cholesterol recode high_cholesterol 2=1 1=0 drop AC **heart_disease** encode AD, gen (heart_disease) move heart_disease AD label drop heart_disease recode heart_disease 1=0 2=1 drop AD **heart_attack** gen heart_attack=. move heart_attack infarto recode heart_attack .=0 if infarto=="Unchecked" recode heart_attack .=1 if infarto=="Checked" la var heart_attack infarto drop infarto **angina** encode Angina, gen (angina) move angina Angina label drop angina recode angina 2=0 drop Angina **heart_failure** gen heart_failure =. recode heart_failure .=0 if Insuficienciacardica=="Unchecked" recode heart_failure .=1 if Insuficienciacardica=="Checked" move heart_failure Insuficienciacardica drop Insuficienciacardica **another_heart_disease** encode outra, gen (another_heart_disease) move another_heart_disease outra label drop another_heart_disease recode another_heart_disease 1=0 drop outra **stroke** encode AI, gen (stroke) move stroke AI label drop stroke recode stroke 2=1 1=0 drop AI **arthritis_rheumatism** encode AJ, gen (arthritis_rheumatism) move arthritis_rheumatism AJ label drop arthritis_rheumatism recode arthritis_rheumatism 2=1 1=0 drop AJ **depression** encode AK, gen(depression) move depression AK label drop depression recode depression 2=1 1=0 drop AK **lung_disease** encode AL, gen(lung_disease) move lung_disease AL label drop lung_disease recode lung_disease 2=1 1=0 drop AL **cancer_first_diagnosis** gen cancer_first_diagnosis1=. recode cancer_first_diagnosis1 .=1 if cancer_first_diagnosis=="Pulmão" recode cancer_first_diagnosis1 .=2 if cancer_first_diagnosis=="Intesti0" recode cancer_first_diagnosis1 .=4 if cancer_first_diagnosis=="Mama" recode cancer_first_diagnosis1 .=5 if cancer_first_diagnosis=="Colo de útero" recode cancer_first_diagnosis1 .=6 if cancer_first_diagnosis=="Próstata" recode cancer_first_diagnosis1 .=7 if cancer_first_diagnosis=="Pele" move cancer_first_diagnosis1 cancer_first_diagnosis drop cancer_first_diagnosis rename cancer_first_diagnosis1 cancer_first_diagnosis **health_self_evalua** encode health_self_evalua, gen (health_self_evalua1) move health_self_evalua1 health_self_evalua recode health_self_evalua1 2=1 3=5 1=2 4=3 5=4 label drop health_self_evalua1 drop health_self_evalua rename health_self_evalua1 health_self_evalua **chest_pain** encode chest_pain, gen( chest_pain1) move chest_pain1 chest_pain label drop chest_pain1 recode chest_pain1 1=0 2=. 3=1 drop chest_pain rename chest_pain1 chest_pain **sleep_quality** encode sleep_quality, gen ( sleep_quality1) move sleep_quality1 sleep_quality label drop sleep_quality1 recode sleep_quality1 3=1 1=3 drop sleep_quality rename sleep_quality1 sleep_quality **tiredness** encode tiredness, gen ( tiredness1) move tiredness1 tiredness label drop tiredness1 recode tiredness1 3=1 1=3 drop tiredness rename tiredness1 tiredness **lack_of_interest** encode lack_of_interest, gen(lack_of_interest1) move lack_of_interest1 lack_of_interest label drop lack_of_interest1 recode lack_of_interest1 3=1 1=3 drop lack_of_interest rename lack_of_interest1lack_of_interest **depress_self_percp** encode depress_self_percp, gen(depress_self_percp1) move depress_self_percp1 depress_self_percp label drop depress_self_percp1 recode depress_self_percp1 3=1 1=3 drop depress_self_percp rename depress_self_percp1 depress_self_percp **low_self_esteem** encode low_self_esteem, gen(low_self_esteem1) move low_self_esteem1 low_self_esteem label drop low_self_esteem1 recode low_self_esteem1 3=1 1=3 drop low_self_esteem rename low_self_esteem1 low_self_esteem **raw_vegetable** encode raw_vegetable, gen(raw_vegetable1) move raw_vegetable1 raw_vegetable label drop raw_vegetable1 recode raw_vegetable1 8=0 drop raw_vegetable rename raw_vegetable1 raw_vegetable **raw_veg_daily** encode raw_veg_daily, gen(raw_veg_daily1) move raw_veg_daily1 raw_veg_daily label drop raw_veg_daily1 drop raw_veg_daily rename raw_veg_daily1 raw_veg_daily **cooked_vegetable** encode cooked_vegetable, gen(cooked_vegetable1) move cooked_vegetable1 cooked_vegetable label drop cooked_vegetable1 recode cooked_vegetable1 8=0 drop cooked_vegetable rename cooked_vegetable1 cooked_vegetable **cooked_veg_daily** encode cooked_veg_daily, gen(cooked_veg_daily1) move cooked_veg_daily1 cooked_veg_daily label drop cooked_veg_daily1 drop cooked_veg_daily rename cooked_veg_daily1 cooked_veg_daily **alcohol_intake** encode alcohol_intake, gen(alcohol_intake1) move alcohol_intake1 alcohol_intake label drop alcohol_intake1 recode alcohol_intake1 2=0 3=2 drop alcohol_intake rename alcohol_intake1 alcohol_intake **alcohol_intake_freq** encode alcohol_intake_freq, gen(alcohol_intake_freq1) move alcohol_intake_freq1 alcohol_intake_freq label drop alcohol_intake_freq1 recode alcohol_intake_freq1 8=0 drop alcohol_intake_freq rename alcohol_intake_freq1 alcohol_intake_freq **alcohol_int_at_once_freq** encode alcohol_int_at_once_freq, gen(alcohol_int_at_once_freq1) move alcohol_int_at_once_freq1 alcohol_int_at_once_freq label drop alcohol_int_at_once_freq1 recode alcohol_int_at_once_freq1 1=0 2=1 3=2 4=3 5=4 6=5 7=6 8=7 drop alcohol_int_at_once_freq rename alcohol_int_at_once_freq1 alcohol_int_at_once_freq **current_smoking_status** encode current_smoking_status, gen (current_smoking_status1) move current_smoking_status1 current_smoking_status label drop current_smoking_status1 recode current_smoking_status1 1=0 2=1 3=2 la def current_smoking_status1 0"Nao fuma atualmente" 1"Sim, diariamente" 2"Sim, menos que diariamente" la val current_smoking_status1 current_smoking_status1 drop current_smoking_status rename current_smoking_status1 current_smoking_status **physical_act_freq** capture split physical_act_freq, p(d) //replace physical_act_freq1 = "0" in 157 destring physical_act_freq1, replace force drop physical_act_freq2 move physical_act_freq1 physical_act_freq drop physical_act_freq rename physical_act_freq1 physical_act_freq **physical_act_history** encode physical_act_history, gen(physical_act_history1) move physical_act_history1 physical_act_history label drop physical_act_history1 recode physical_act_history1 6=1 5=2 1=3 2=4 5=4 3=5 4=6 drop physical_act_history rename physical_act_history1 physical_act_history **daily_tv_time** encode daily_tv_time, gen(daily_tv_time1) move daily_tv_time1 daily_tv_time label drop daily_tv_time1 recode daily_tv_time1 8=1 7=2 2=3 3=4 4=5 5=6 6=7 1=8 drop daily_tv_time rename daily_tv_time1 daily_tv_time **daily_comp_time** encode daily_comp_time, gen(daily_comp_time1) move daily_comp_time1 daily_comp_time label drop daily_comp_time1 recode daily_comp_time1 8=1 7=2 2=3 3=4 4=5 5=6 6=7 1=8 drop daily_comp_time rename daily_comp_time1 daily_comp_time **public_space_structure** encode public_space_structure, gen(public_space_structure1) move public_space_structure1 public_space_structure label drop public_space_structure1 recode public_space_structure1 2=1 1=2 4=3 5=4 3=5 drop public_space_structure rename public_space_structure1 public_space_structure **program_teachers** encode program_teachers, gen(program_teachers1) move program_teachers1 program_teachers label drop program_teachers1 recode program_teachers1 2=1 1=2 4=3 drop program_teachers rename program_teachers1 program_teachers **program_interns** encode program_interns, gen(program_interns1) move program_interns1 program_interns label drop program_interns1 recode program_interns1 2=1 1=2 drop program_interns rename program_interns1 program_interns **program_employees** encode program_employees, gen(program_employees1) move program_employees1 program_employees label drop program_employees1 recode program_employees1 2=1 1=2 4=3 5=4 3=5 drop program_employees rename program_employees1 program_employees **weight_status** encode weight_status, gen(weight_status1) move weight_status1 weight_status label drop weight_status1 recode weight_status1 4=1 1=2 2=3 3=4 drop weight_status rename weight_status1 weight_status **stress_level** encode stress_level, gen(stress_level1) move stress_level1 stress_level label drop stress_level1 recode stress_level1 4=1 1=2 2=4 drop stress_level rename stress_level1 stress_level **stress_in_health** encode stress_in_health, gen(stress_in_health1) move stress_in_health1 stress_in_health label drop stress_in_health1 recode stress_in_health1 2=1 1=2 drop stress_in_health rename stress_in_health1 stress_in_health **sleep_hours** encode sleep_hours, gen(sleep_hours1) move sleep_hours1 sleep_hours label drop sleep_hours1 recode sleep_hours1 4=1 1=2 2=3 3=4 drop sleep_hours rename sleep_hours1 sleep_hours **seated_time_weekend** capture split seated_time_weekend, p(h) move seated_time_weekend1 largest_weight move seated_time_weekend2 largest_weight capture split seated_time_weekend2, p(m) replace seated_time_weekend1=. if seated_time_weekend1>=60 gen seated_time_weekend_hora= seated_time_weekend1*60 move seated_time_weekend_hora seated_time_weekend1 egen seated_time_weekend_novo = rowtotal (seated_time_weekend_hora seated_time_weekend21) move seated_time_weekend_novo largest_weight replace seated_time_weekend_novo=. if seated_time_weekend_hora==. & seated_time_weekend21==. drop seated_time_weekend seated_time_weekend_hora seated_time_weekend1 seated_time_weekend21 rename seated_time_weekend_novo seated_time_weekend **largest_weight** capture split largest_weight, p(k) drop largest_weight2 move largest_weight1 largest_weight destring largest_weight1, replace drop largest_weight rename largest_weight1 largest_weight ////CATEGORIZANDO AS VARI–EIS////// **Escolaridade categorizada - Ordinal //Fundamental incompleto; fundamental completo; mꥩo incompleto; mꥩo completo; superior incompleto; superior completo; p󳠧radua褯 (1) //years_of_edu years_of_edu_2 years_of_edu_3 years_of_edu_4 years_of_edu_5 years_of_edu_6// gen schooling=. recode schooling .=1 if years_of_edu<8 & years_of_edu_2==. & years_of_edu_3==. & years_of_edu_4==. & years_of_edu_5==. & years_of_edu_6==. recode schooling .=2 if years_of_edu>=8 & years_of_edu_2==. & years_of_edu_3==. & years_of_edu_4==. & years_of_edu_5==. & years_of_edu_6==. recode schooling .=3 if years_of_edu_2<3 & years_of_edu_3==. & years_of_edu_4==. & years_of_edu_5==. & years_of_edu_6==. recode schooling .=4 if years_of_edu_2==3 & years_of_edu_3==. & years_of_edu_4==. & years_of_edu_5==. & years_of_edu_6==. recode schooling .=5 if years_of_edu_3<4 & years_of_edu_4==. & years_of_edu_5==. & years_of_edu_6==. recode schooling .=6 if years_of_edu_3>=4 & years_of_edu_4==. & years_of_edu_5==. & years_of_edu_6==. recode schooling .=7 if years_of_edu_4~=. | years_of_edu_5~=. la def schooling 1"fundamental incompleto" 2"fundamental completo" 3"medio incompleto" 4"medio completo" 5"superior incompleto" 6"superior completo" 7"p󳠧radua褯" la val schooling schooling **GDS15** //Ponto de corte <5 suspeita de depress䯍 egen gds15 = rowtotal (gds_q1 gds_q2 gds_q3 gds_q4 gds_q5 gds_q6 gds_q7 gds_q8 gds_q9 gds_q10 gds_q11 gds_q12 gds_q13 gds_q14 gds_q15) gen gds15_cat = gds15 recode gds15_cat min/5=0 5.999999/max=1 **SF6D** //functional_cap global_lim social_aspc pain mental_health vitality// gen pf1=. recode pf1 .=0 if functional_cap==1 recode pf1 .=-.051 if functional_cap==2 recode pf1 .=-.051 if functional_cap==3 recode pf1 .=-.051 if functional_cap==4 recode pf1 .=-.051 if functional_cap==5 recode pf1 .=-.096 if functional_cap==6 gen sc1=. recode sc1 .=0 if social_aspc==1 recode sc1 .=.038 if social_aspc==2 recode sc1 .=.040 if social_aspc==3 recode sc1 .=.060 if social_aspc==4 recode sc1 .=.068 if social_aspc==5 recode rl1 .=0 if global_lim==1 recode rl1 .=-.048 if global_lim==2 recode rl1 .=-.048 if global_lim==3 recode rl1 .=-.048 if global_lim==4 gen pn1=. recode pn1 .=0 if pain==1 recode pn1 .=-.060 if pain==2 recode pn1 .=-.060 if pain==3 recode pn1 .=-.060 if pain==4 recode pn1 .=-.074 if pain==5 recode pn1 .=-.087 if pain==6 gen mh1=. recode mh1 .=0 if mental_health==1 recode mh1 .=-.047 if mental_health==2 recode mh1 .=-.047 if mental_health==3 recode mh1 .=-.047 if mental_health==4 recode mh1 .=-.067 if mental_health==5 gen v1=. recode v1 .=0 if vitality==1 recode v1 .=-.033 if vitality==2 recode v1 .=-.033 if vitality==3 recode v1 .=-.033 if vitality==4 recode v1 .=-.052 if vitality==5 gen sf6d_score = 1 + pf1+rl1+sc1+pn1+mh1+v1 **sleep_problems** gen sleep_problems=. recode sleep_problems .=1 if sleep_quality ==3 | sleep_quality ==4 | sleep_hours==1 | sleep_hours==2 | tiredness==3 | tiredness==4 recode sleep_problems .=0 if sleep_quality ==1 | sleep_quality ==2 | sleep_hours==3 | sleep_hours==4 | tiredness==1 | tiredness==2 **sleep_problems2** gen sleep_problems2=. recode sleep_problems2 .=1 if sleep_quality ==3 | sleep_quality ==4 | sleep_hours==1 | sleep_hours==2 recode sleep_problems2 .=0 if sleep_quality ==1 | sleep_quality ==2 | sleep_hours==3 | sleep_hours==4 **imc** gen height_m = height_cm/100 gen imc= peso/(height_m*height_m) gen imc_3c = imc recode imc_3c min/22.999999=0 23/26.999999=1 27/max=2 la def imc_3c 0"Baixo peso" 1"Peso adequado" 2"Sobrepeso" la val imc_3c imc_3c ** PAS e PAD** egen pad_mean = rowmean ( pressodeconsultriopad1 pressodeconsultriopad2 pressodeconsultriopad3) egen pas_mean = rowmean ( pressodeconsultriopas1 pressodeconsultriopas2 pressodeconsultriopas3) **idade 3 categorias*** gen age_3c = age recode age_3c min/69.999999=1 70/79.999999=2 80/max=3 la def age_3c 1"60 - 69" 2"70 - 79" 3"80+" la val age_3c age_3c ***TABELA 3*** **alcohol excess gen alcohol_excess_reg = alcohol_intake_freq*alcohol_int_amount gen alcohol_excess_reg2 = alcohol_excess_reg recode alcohol_excess_reg2 min/14=0 15/max=1 **veg_intake** gen cook_veg =. recode cook_veg .=0 if cooked_veg_daily==1 | cooked_vegetable<=4 recode cook_veg .=1 if cooked_veg_daily==2 | cooked_veg_daily==3 & cooked_vegetable>4 recode cook_veg .=0 if cooked_vegetable==0 gen raw_veg =. recode raw_veg .=0 if raw_veg_dail==1 | raw_vegetable<=4 recode raw_veg .=1 if raw_veg_dail==2 | raw_veg_dail==3 & raw_vegetable>4 recode raw_veg .=0 if raw_vegetable==0 gen veg_intake = . recode veg_intake .=1 if raw_veg==1 | cook_veg==1 recode veg_intake .=0 if raw_veg==0 & cook_veg==0