I love SAS, I love the flexibility, but sometimes you wonder if there is an easier way to do things.....
Coming from SPSS and Stata, these programs had a great ability to split data and organise output
Let me give an example: whenever you have subgroups and analyse your data with SPSS, then you have the option of "Split File", it allows you to organise the outcome as separate tables or aggregate the outcome in one easily readable file, see the link bellow, where it is shown for descriptive statistics but the same can be done with regression models
https://www.youtube.com/watch?v=2mKU8Sev6Gk
the "BY" statement in SAS creates separate tables and the output can be so long and confusing and difficult to read.
I did a proc logistic in SAS with only one independent variabel just to get the unadjusted OR and then repeated the analyses for the 9 subgroups I have in my date with the BY statement, so imagine have the output for proc logistic repeated 9 times.... messy!
I re-did it in SPSS, using the option "Split File-Compare Groups", the outcome was neat and easy to read
Isn't there a simple way to do that in SAS too?
Best wishes
You can highly customize your output in SAS.
Some ways are using ODS SELECT Statements to keep only tables of interest.
Others are to use ODS TABLE/OUTPUT to have all the output placed in one table and then customize the output from there.
ods table parameterestimates=want;
proc logistic data=have;
by group;
model a = b c d;
run;
proc print data=want;
run;
I dont know if it really solves the whole problem, or dose it?
It is still too complicated, seems like re-inventing the wheel
I am aware of using ODS, cumbersome, I think
so let us try to solve this one, we do it the way you suggested
ods output OddsRatios=asd;
proc logistic data=have ;
class Var1 Var2;
model Var1 =Var2;
by Var3;
run
proc print data=asd;
run;
This way i will be able to save all the OR and their CI in the table
But
How about if I wanted to add data from another section of the output?
eg you can do this to get the Wald statistics:
ods output Type3=asd;
proc logistic data=have ;
class Var1 Var2;
model Var1 =Var2;
by Var3;
run;
proc print data=asd;
run;
So how would you do to get both the OR and the Wald in the same table?
Yes it is solvable with GLIMMIX,
ODS OUTPUT DIFFS=dfs;
PROC GLIMMIX data=have ;
class Var1 Var2;
MODEL Var1 = Var2 / dist=binary link=logit;
LSMEANS Var2 / ilink diff oddsratio cl;
by Var3;
RUN;
Proc Print data=dfs;
run;
But what if I want to do it with proc logistic? How do you combine information from two tables in the ODS of proc logistic? (I hope you wont use a Data Set or Merge or SQL for that)
Why not merge? I can merge tables and get output straight to PDF or Word docs for journal publications from SAS.
No language has everything.
If thats too difficult why not stick with SPSS then.
Difficult: NO, and the first line in my question tells you I want to stick with SAS, and I also gave different solutions to show I can do it
Effective: NO, unfortunately it is much faster with other softwares
And YES you are right, no language has it all, though I wish....
If its an issue you continuously run into either write a macro to solve it and/or put a suggestion in SAS ideas.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.