I have a study where I am to look 28 days back in time before an event to see if the patients were working or not working.
Each patient has a different event date (i.e. var date_ascd).
Relevant variables:
y_yyww (year and week, e.g. y_1410 means year 2014 and week 10. Format %10.0g and type int)
date_ascd (date format %tdD_m_Y, type long)
status_onemonthprior (date format %td, type float)
bbcombination (str6, %9s)
The variable y_yyww tells me if the patient was working or not prior to the event using different values (e.g. value 299 means the patient received sick leave pay). If the patient has a variable with the name y_1410 with the value of 299 it means the patient received sick leave pay in 2014, week 10. This variable is reported weekly. The variable y_yyww reaches a maximum of 52 weeks.
The var status_onemonthprior tells me the date 4 weeks prior to the event date.
The var bbcombination is a var calculated using the date from status_onemonthprior and we end up with string values of e.g. y_1410 if we want to look through the y_yyww variable using that name.
My issue
I would like go through all of my y_1401-y_1501 variables and see if any of the variables has the same name as bbcombination's value. If that is the case then I would like to generate a new variable called y_onemonthprior that has the same value as the value that has the same name as bbcombination's value.
Meaning, I would end up with a new variable called y_onemonthprior with the value of e.g. 299. This value can differ from patient to patient according to work status.
Is this in any way possible?
Related Posts with Get name of specific variable which name is equal to another value of a variable
Loop by group in a variable and selecting by conditional Hello, I must select the families "family" that meet the condition of having children. base example…
VECM multiple cointegrating equation interpretationI have a problem to interpret multiple cointegrating equations. 1. As I understand I do include ce1 …
rename variables using loopsHi, I want to reshape the following wide type of data to long type. id c1 c2 c3 1 100 200 300 …
Finding mean value of a column based on yearHi, I am a newbie with STATA and working with it for my thesis. So, I have a dataset of companies f…
Is my use of a t-test with this data appropriate?Hallo Apologies for not using dataex. I have tried and failed to install it (I used ssc install dat…
Subscribe to:
Post Comments (Atom)
0 Response to Get name of specific variable which name is equal to another value of a variable
Post a Comment