Tag: tips and tricks

Learn SAS
Jim Simon 0
Random Sampling: What's Efficient?

Suppose you wish to select a random sample from a large SAS dataset.  No problem. The PROC SURVEYSELECT step below randomly selects a 2 percent sample: proc surveyselect data=large out=sample method=srs /* simple random sample */ n=1000000; /* sample size */ run; Do you have a SAS/STAT license?   If not,

Learn SAS
Jim Simon 0
Reading Hierarchical Data - Part 3

This post is the third and final in a series that illustrates three different solutions to "flattening" hierarchical data.  Don't forget to catch up with Part 1 and Part 2. Solution 2, from my previous post, created one observation per header record, with detail data in a wide format, like

Learn SAS
Jim Simon 0
Reading hierarchical data - Part 2

This post is the second in a series that illustrates three different solutions to "flattening" hierarchical data. Solution 1, from my previous post, created one observation per header record, summarizing the detail data with a COUNT variable, like this: Summary Approach: One observation per header record   Obs Family Count

Learn SAS
Jim Simon 0
Reading hierarchical data - Part 1

A family and its members represent a simple hierarchy.  For example, the Jones family has four members: A text file might represent this hierarchy with family records followed by family members' records, like this:   The PROC FORMAT step below defines the codes in Column 1: proc format; value $type

Learn SAS
Jim Simon 0
DATA STEP text file tricks

When reading a text file (common extensions: TXT, DAT; or, for the adventurous: HTML) with the DATA STEP, you should always view several lines from the text file, and compare to the record layout, before completing the INPUT statement.  There are many ways to view a text file.  I use

Learn SAS
Jim Simon 0
Weird PROC FREQ trick

Default PROC FREQ output looks like this: Suppose you don't want the two cumulative statistic columns above.  No problem.  Those can be suppressed with the NOCUM option on the TABLE statement, like this: proc freq data=sashelp.shoes; table product / nocum; run;

Learn SAS
Jim Simon 0
Dataset too big for PROC PRINT?

Dataset too big for PROC PRINT? One weird trick solves your problem! proc print data=bigdata (obs=10); run; The OBS= dataset option specifies the last observation to process from an input dataset. In the above example, regardless of dataset size, only the first 10 observations are printed; an easy way to

Learn SAS
Maggie Miller 0
Top 10 SAS Training Post blogs

December is all about traditions. Some of mine include holiday shopping, baking (I really mean eating) Christmas cookies and putting together my annual list of most read blogs on the SAS Training Post. So as traditions go… here’s my list of the top 10 most read blogs in 2014. How