Hi everyone,
I’m a longtime lurker, and first time poster. I really appreciate the detailed info shared here. This forum has helped me tremendously with several projects.
I apologize if this is too complicated of a request, but I just don’t seem to be able to put together something that works as automatically as I’d like, so I was hoping someone more knowledgeable might help out with some specific VBA code.
I have a bunch of files with a series of logistic regression models separated by two blank rows. Each model is headed with “var” and “Exp(B)” and contains markers of significance in a third column. I would like to condense all this info into a list with several columns representing each model (see below for example). In each file, the bottom-most model has the full set of variables (this is somewhere between 6 and 22 variables). My goal is to create a chart using the bottom-most model as a guide for all available variables, and then automatically transfer the values and significance marks into columns to the right in order of the models. I’m okay with this being in the same sheet or a new sheet.
For example, if I have a file with:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Var[/TD]
[TD]Exp(B)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]yellow[/TD]
[TD].34[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]green[/TD]
[TD].45[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]blue[/TD]
[TD].82[/TD]
[TD]**[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Var[/TD]
[TD]Exp(B)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]yellow[/TD]
[TD].34[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]green[/TD]
[TD].44[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD].65[/TD]
[TD]**[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Var[/TD]
[TD]Exp(B)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]yellow[/TD]
[TD].43[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]green[/TD]
[TD].56[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]blue[/TD]
[TD].56[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD].45[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
—
I’d like to convert it to:
[TABLE="width: 500"]
<tbody>[TR]
[TD]var[/TD]
[TD]1[/TD]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]yellow[/TD]
[TD].34[/TD]
[TD][/TD]
[TD].34[/TD]
[TD][/TD]
[TD].43[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]green[/TD]
[TD].45[/TD]
[TD]*[/TD]
[TD].44[/TD]
[TD][/TD]
[TD].56[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]blue[/TD]
[TD].82[/TD]
[TD]**[/TD]
[TD]--[/TD]
[TD][/TD]
[TD].56[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]--[/TD]
[TD][/TD]
[TD].65[/TD]
[TD]**[/TD]
[TD].45[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
If anyone could help me out in writing something systematic and flexible code that allows the final model to shape the list regardless of the number of variables it contains, I’d really really really appreciate it!!!
I’m a longtime lurker, and first time poster. I really appreciate the detailed info shared here. This forum has helped me tremendously with several projects.
I apologize if this is too complicated of a request, but I just don’t seem to be able to put together something that works as automatically as I’d like, so I was hoping someone more knowledgeable might help out with some specific VBA code.
I have a bunch of files with a series of logistic regression models separated by two blank rows. Each model is headed with “var” and “Exp(B)” and contains markers of significance in a third column. I would like to condense all this info into a list with several columns representing each model (see below for example). In each file, the bottom-most model has the full set of variables (this is somewhere between 6 and 22 variables). My goal is to create a chart using the bottom-most model as a guide for all available variables, and then automatically transfer the values and significance marks into columns to the right in order of the models. I’m okay with this being in the same sheet or a new sheet.
For example, if I have a file with:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Var[/TD]
[TD]Exp(B)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]yellow[/TD]
[TD].34[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]green[/TD]
[TD].45[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]blue[/TD]
[TD].82[/TD]
[TD]**[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Var[/TD]
[TD]Exp(B)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]yellow[/TD]
[TD].34[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]green[/TD]
[TD].44[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD].65[/TD]
[TD]**[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Var[/TD]
[TD]Exp(B)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]yellow[/TD]
[TD].43[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]green[/TD]
[TD].56[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]blue[/TD]
[TD].56[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD].45[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
—
I’d like to convert it to:
[TABLE="width: 500"]
<tbody>[TR]
[TD]var[/TD]
[TD]1[/TD]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]yellow[/TD]
[TD].34[/TD]
[TD][/TD]
[TD].34[/TD]
[TD][/TD]
[TD].43[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]green[/TD]
[TD].45[/TD]
[TD]*[/TD]
[TD].44[/TD]
[TD][/TD]
[TD].56[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]blue[/TD]
[TD].82[/TD]
[TD]**[/TD]
[TD]--[/TD]
[TD][/TD]
[TD].56[/TD]
[TD]*[/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]--[/TD]
[TD][/TD]
[TD].65[/TD]
[TD]**[/TD]
[TD].45[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
If anyone could help me out in writing something systematic and flexible code that allows the final model to shape the list regardless of the number of variables it contains, I’d really really really appreciate it!!!