Write and run SAS programs in your web browser

Manipulation of data tables in excel vs. in SAS

Reply
New Contributor
Posts: 2

Manipulation of data tables in excel vs. in SAS

[ Edited ]

Hi- I am JUST getting started in learning to use SAS OnDemand.  I am trying to understand why I should use SAS data procs to create subsets of my data... as someone who already knows how to use excel, doesn't it make more sense for me to just make csv files for each and every relationship I want to test, and then make a SAS data table for each one of those?  I'm not doing anything super complicated: just running two factor ANOVAs.  Or am I missing something in my understanding of how to use SAS?

 

Thanks very much,

 

Andy_R

Grand Advisor
Posts: 9,748

Re: Manipulation of data tables in excel vs. in SAS

One of the very powerful tools in SAS is BY group processing; You can do the analysis for each of your subgroups with the data in one dataset. Sort the data by the grouping variable(s) and add a BY statement referencing those variables in the Anova code.

For instance suppose you are grouping data by State and County for your analyis. That would be creating one csv file for literally hundreds if not thousands of counties. In SAS: add

 

proc (whatever) data=dataset;

    by State County;

<analysis options>

;

run;

 

You get separate output for each existing combination of state and county.

 

I learned SAS before Excel existed and always feel crippled when trying to do anything in Excel, often because of just this behavior.

 

New Contributor
Posts: 2

Re: Manipulation of data tables in excel vs. in SAS

thanks for your response!

 

So you feel it makes more sense to convert the giant data set (had been entered in Excel) into one giant csv, import as one giant table, and then do procs on that set from within SAS using a BY statement for each separate analysis?

Grand Advisor
Posts: 9,748

Re: Manipulation of data tables in excel vs. in SAS

Generally yes. If your data fits into a single Excel worksheet then it isn't considered "giant" by SAS. SAS can handle many more rows and columns than Excel.

 

A second thing that comes in handy are things like WHERE statements or dataset options to select records with specific characteristics.

Suppose after looking at the first analysis I realize that it included a bunch of products that weren't pertinent, or I wanted to concentrate on a selection of characterisitc. In many procedures you could add a statement like:

Where productcode in ('ProductId1' 'ProductId2' 'ProductId3') AND Sales> 5000;

 

To the previous code. Again generating Lots of potential output but reduced to the specified Products and where the variable Sales is larger than 5000 for each record.

Esteemed Advisor
Posts: 5,988

Re: Manipulation of data tables in excel vs. in SAS

Any data entered in Excel is at best "puny" from a SAS perspective.

Try entering 150 million rows with 2000 columns in Excel.

 

Subsetting/splitting data is much easier done in SAS than in Excel. And, since you have codes and logs, it is easier to document and easier to control.

 

Don't confuse a spreadsheet calculator with BI software.

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Grand Advisor
Posts: 16,393

Re: Manipulation of data tables in excel vs. in SAS

SAS should be able to import directly from the Excel file as well.
Post a Question
Discussion Stats
  • 5 replies
  • 286 views
  • 3 likes
  • 4 in conversation