Posts Tagged ‘ sas programming ’

Using a regular expression to validate a SAS variable name

August 22, 2012
By
Using a regular expression to validate a SAS variable name

Regular expressions provide a powerful method to find patterns in a string of text. However, the syntax for regular expressions is somewhat cryptic and difficult to devise. This is why, by my reckoning, approximately 97% of the regular expressions used in code today were copied and pasted from somewhere else.
Read more »

Tags: , , ,
Posted in SAS | Comments Off

Comparing data set schemas in SAS

August 15, 2012
By
Comparing data set schemas in SAS

The project that I'm currently working on requires several input data tables, and those tables must have a specific schema. That is, each input table must contain columns of a specific name, type, and length in order for the rest of the system to function correctly. The schema requirements aren't
Read more »

Tags: , , , ,
Posted in SAS | Comments Off

Suppress variable labels in SAS procedures

August 13, 2012
By
Suppress variable labels in SAS procedures

Sometimes a small option can make a big difference. Last week I thought to myself, "I wish there were an option that prevents variable labels from appearing in a table or graph." Well, it turns out that there is! I was using PROC MEANS to display some summary statistics, and
Read more »

Tags: , ,
Posted in SAS | Comments Off

Discriminating Fisher’s iris data by using the petal areas

August 9, 2012
By
Discriminating Fisher’s iris data by using the petal areas

I've seen analyses of Fisher's iris data so often that sometimes I feel like I can smell the flowers' scent. However, yesterday I stumbled upon an analysis that I hadn't seen before. The typical analysis is shown in the documentation for the CANDISC procedure in the SAS/STAT documentation. A (canonical)
Read more »

Tags: , ,
Posted in SAS | Comments Off

Simulation in SAS: The slow way or the BY way

July 18, 2012
By
Simulation in SAS: The slow way or the BY way

Over the past few years, and especially since I posted my article on eight tips to make your simulation run faster, I have received many emails (often with attached SAS programs) from SAS users who ask, beg, and—in one case—even offer to pay for advice about how to speed up
Read more »

Tags: , , ,
Posted in SAS | Comments Off

Programming tip: Avoid testing floating point values for equality

June 25, 2012
By

No matter what statistical programming language you use, be careful of testing for an exact value of a floating-point number. This is known in the world of numerical analysis as "10.0 times 0.1 is hardly ever 1.0" (Kernighan and Plauger, 1974, The Elements of Programming Style). There are many examples
Read more »

Tags: , , ,
Posted in SAS | Comments Off

Compute a running total

June 22, 2012
By

A reader wrote for help with a computational problem. He has a vector of length N and the vector contains integer values in the range , which represent months for which events occurred over a 10-year period. The question is: what is the 24-month period for which the most
Read more »

Tags: , ,
Posted in SAS | Comments Off

Read a Microsoft date-time value into a SAS date-time value

June 14, 2012
By

A colleague was recently working with a web service that supplies some date-time values using the Microsoft Windows internal representation. He called the web service to retrieve those values (along with other data) from SAS, and he needed convert these values to SAS date-time values. The Microsoft definition for a
Read more »

Tags: , , , ,
Posted in SAS | Comments Off

Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.