Hello All,
I am currently working on a project on effects on antibiotics and hypoglycemia. I wrote the following code to generate a fisher plot for Hypoglycemia and antibiotics and other variables. The code given below worked completely fine and generated a table of odds ratios with confidence intervals and the corresponding Fisher Plot for the same.
Now my question is I want to have another dependent variable besides HYPOGLYCEMIA. The other DEPENDENT variable is Severe Hypoglycemia and is also a 1/0 response like hypoglycemia.
How do I modify the below code to get a fisher plot and odds ratios for both hypoglycemia and severe hypoglycemia on 1 plot? Is this doable? please help .. so basically the fisher plot would have two sets of odds ratios on it one for hypoglycemia and one for the other dv which is severe hypoglycemia..
Idk do I just do model hypoglycemia severe hypoglycemia = ... and leave everything else the same but I don't think that would work..
Below is the cod ethat worked for just hypoglycemia alone:
If you want to display two separate analysis then the basic steps are
1) run the Proc Logistic separately for each dependent variable creating a separate output data set for each.
2) combine the data sets with a data step Set and add a variable to indicate which data set contributed the data.
3) use that added variable in Proc Sgplot, using the new combined data, with a Group=variable option on the Scatter statement.
If you haven't combined data sets with such here is dummy code using the data set option IN= to provide values to create that suggested grouping var.
data combined; set set1 (in=in1) set2 (in=in2) <repeat as needed> end; length groupvar $ 25; /*make this large enough to hold the longest text you want*/ if in1 then groupvar="meaning of set one"; else if in2 then groupvar= "meaning of set two"; /* repeat for additional sets and their IN variables*/ run;
and plot:
proc sgplot data=combined; scatter x=oddsratioest y=effect / group=groupvar xerrorlower=lowercl xerrorupper=uppercl ; refline 1 / axis=x; run;
I removed MARKERATTRS as each group by default will have a different symbol for most ODS styles. If you want to change the default markers you would look at a STYLEATTRS to change multiple.
This is one way. The other would be the create separate output sets from the logistic, combine them but rename the Y variable for each and use separate SCATTER statements for each with the different Y variable(s).
If you expect to do something about the interaction of the 2 dependent variables that is quite a different thing all together.
thanks so much for your response
so I have never done this before
assuming data set 1 is the odds ratio for 1st dependent variable and called odds1
and data set 2 is the odds ratio for 2nd dependent variables and called odds2
can you tell me how the code you suggested would be written? pleaseeeee? sorry i am a little confused with what goes in stuff like in=, meaning of set1,2 etc
thanks so much
@manthan wrote:
thanks so much for your response
so I have never done this before
assuming data set 1 is the odds ratio for 1st dependent variable and called odds1
and data set 2 is the odds ratio for 2nd dependent variables and called odds2
can you tell me how the code you suggested would be written? pleaseeeee? sorry i am a little confused with what goes in stuff like in=, meaning of set1,2 etc
thanks so much
Use Odds1 where I used Set1, use Odds2 where I used Set2 the data set creating combined.
Pretty much exactly as shown only use your data set names and meaningful values for the groupvar.
The <repeat as needed> would be if you created Odds3, Odds4 (until you get tired) and want to combine all of them for the same plot.
One thing to keep in mind for most combined plots is that one of the axis variables, the X axis for most, has to be the same name for each point plotted. The axis will adjust to handle different ranges of values (at least within reason) but the name is the same.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.