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?
0 Response to Get name of specific variable which name is equal to another value of a variable
Post a Comment