LINDA ADAM'S SAS TIPS

Quick tips for using SAS(r) Software.

Thursday, February 08, 2007

Creating Cumulative Totals

›
Here's how to update a SAS data set to include cumulative totals for a numeric variable. In this example, he goal is to create a new var...
33 comments:
Monday, October 30, 2006

The Monotonic Function

›
There is an undocumented function that enables you to generate observation numbers with a PROC SQL statement and retain them in an output da...
14 comments:
Monday, October 23, 2006

Exporting Multiple Data Sets to One Spreadsheet

›
It's easy to export several data sets to one Excel spreadsheet with each data set in a separate worksheet.This example exports three SAS...
32 comments:
Friday, October 20, 2006

Where or If?

›
When is it most efficient to use a WHERE statement vs. a subsetting IF statement? The answer is (of course) it depends. When subsetting fr...
5 comments:

Choosing the Most Efficient Procedure

›
There’s often several ways to accomplish the same task with SAS. The question is, are there any guidelines to determine the most efficient m...
5 comments:

Creating an Index with PROC DATASETS

›
An index is an optional file you can create for a SAS data set to specify the location of observations based on values of one or more key va...
2 comments:
Wednesday, October 18, 2006

Appending Files Efficiently

›
There are a couple of methods you can use to concatenate data sets. In these examples, work.step2 is appended to work.step1: With a SET sta...

Modifying Data Sets and Variables Efficiently with PROC DATASETS

›
Data sets and variables can be modified using data steps or PROC DATASETS. Here are a few examples using each method, with the time they too...
1 comment:

Using SAS DATA Step Views to Conserve Data Storage Space

›
A SAS data view is a type of SAS data set that retrieves data values from other files. A SAS data view only contains descriptor information ...
10 comments:

Emailing SAS Output

›
Every need to email your SAS output? You can save the contents of the log or output window then use Outlook to email the file, or you can w...

A Quick Debugging Tip

›
If you are working on a lengthy program you can save some time debugging it by first submitting it with zero observations: OPTIO...
5 comments:

PROC SQL and the DESCRIBE TABLE Statement

›
You can use the DESCRIBE TABLE statement in PROC SQL to display information about a SAS dataset. The information is displayed in the log. ...
6 comments:

The %SKIP Macro

›
When working on a lengthy SAS program, there are a couple of ways to block out parts of your code so they don’t execute. For example, you ca...
1 comment:

Using Data Sets without Libnames

›
You can directly reference SAS data sets without defining a libname first. Just enclose the physical file name in quotes: proc contents d...

Using PROC DOWNLOAD for Non-SAS Files

›
You can use proc download for files that are not SAS data sets by using infile and outfile statements. In this example, a file named myfile...
1 comment:

Reading Text from a Zip File

›
There is a currently undocumented (and unsupported) filename engine that can be used to read text from compressed ZIP files directly. You u...
6 comments:

The DATECOPY Option

›
The DATECOPY option in PROC DOWNLOAD can be used when migrating SAS datasets to preserve the original create date and time on the SAS datase...

Debugging Complex Macros

›
You can write code generated by macros to an external file. Since you can see the code that is generated, this technique can be useful for ...

Using Bookmarks

›
You can bookmark a line of code in your Program Editor to make it easier to find later. To bookmark a line, press Ctrl + F2 on the line you ...
1 comment:

Using The SUM Function to Prevent Missing Values

›
You can use the SUM function to prevent missing values if one argument has a missing value. The syntax for using the SUM function to create ...
8 comments:

Using Wildcards in Variable Lists

›
You can use the colon as a variable modifier (e.g. abc:), which acts as a wildcard. So rather than entering variables abc1, abc3 and abcde y...

Another Shortcut for Listing Variables

›
You can keep all of the numeric or character columns when creating a new data set without listing each one in your KEEP statement: data test...

Enclosing Code or Text Within a Block Comment

›
In the PC-SAS enhanced editor it's easy to enclose a block of code or text within a block comment. Just highlight the selected code and ...

Getting Help for a SAS Procedure

›
In the PC-SAS enhanced editor it's easy to get help for a procedure. Just press the mouse button within the procedure name and press F...

Merging Data Sets Faster

›
When merging two SAS data sets, many of us use one of these two methods to keep only the observations where both input data sets contribute:...
4 comments:
Home
View web version
Powered by Blogger.