Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Splitting Data in SAS

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-31-2014 12:17 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-31-2014 01:12 PM

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-31-2014 01:46 PM

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)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-31-2014 01:57 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-31-2014 01:59 PM

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....

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-31-2014 02:18 PM

If its an issue you continuously run into either write a macro to solve it and/or put a suggestion in SAS ideas.