/******************************************************************
Scale ID: 			SNI
Scale Name: 		Falls Efficacy Scale
TILDA Variables: 	FESIscore
Dataset:      		TILDA Wave 1-6
Author:       		
Institution:  		The Irish Longitudinal Study on Ageing (TILDA)

Description:
Generates score for the Social Network Scale.

Version:      1.0
Date:         2026-09-01
Language:     Stata

******************************************************************/


*** Social Participation

recode cn001 (1=1) (5=0) , gen(socParticip)


label variable socParticip "Social participation"
notes socParticip : Whether or not participates in social groups
notes socParticip : Code to generate - recode cn001 (1=1) (5=0) , gen(socParticip)

label define socParticip 1 "Yes" 0 "No" 98 "Don't Know" 99 "Refused",modify
label value socParticip socParticip

*** Attend religious services
*label not applied - SS (v2)
recode dm021 (1/3=0) (4/6=1), gen(Church)
label variable Church "Attends religious services"
notes Church : Whether or not participant attend religious services at least once per month
notes Church : Stat code to generate - recode dm021 (1/3=0) (4/6=1), gen(Church)
label define Church 0 "No" 1 "Yes" 98 "Don't Know" 99 "Refused",modify
label value Church Church

*** Membership of organisations other than Church

*This is idenitical to socParticip - keeping in for consistency, and as it is used to calculated SNI
*label not applied - SS (v2)
*changed to (5=0) - MF (v2)
recode cn001 (1=1) (5=0) , gen(Clubs)
label variable Clubs "Membership in organisation not Church"
notes Clubs : Whether or not R belongs to any clubs/groups
notes Clubs : Code to generate - recode cn001 (1=1) (5=0) , gen(Clubs)
label define Clubs 0 "No" 1 "Yes" 98 "Don't Know" 99 "Refused",modify
label value Clubs Clubs

*** Close relatives or friends
*label not applied - SS (v2)
gen relFriends = 0
replace relFriends = relFriends + cn002 if cn002 > 0
replace relFriends = relFriends + cn003 if cn003 > 0
replace relFriends = relFriends + cn004 if cn004 > 0
replace relFriends = . if cn002<0 & cn003<0 & cn004<0 
label variable relFriends "Count of close relatives or friends"

recode relFriends (0/1=0) (2/max=1) , gen(closeTies)
label variable closeTies "Has at least 2 close friends or relatives"
label define closeTies 0 "No" 1 "Yes",modify
label value closeTies closeTies




*** Social network total


gen socnet = 0 

replace socnet = socnet + 1 if Church == 1
replace socnet = socnet + 1 if cs006 == 1 | cs006==2
replace socnet = socnet + 1 if Clubs == 1
replace socnet = socnet + 1 if closeTies == 1
label variable socnet "Social Connectedness Score"

