Author

Jim Simon
RSS
Principal Technical Training Consultant

Jim Simon is a principal instructor and course developer for SAS Education. Jim has a bachelor's degree from UCLA and a master's degree from California State University at Northridge. Prior to joining the SAS Irvine office in 1988, Jim was an instructor at Ventura College and a SAS programmer at The Medstat Group in Santa Barbara. Jim's areas of specialization include the DATA step, application development, web enablement, and the SAS macro language. A native of Southern California, Jim enjoys anything in the warm California sun. On weekends, Jim loves jumping in his Corvette, turning up the stereo, and cruising Pacific Coast Highway, top down, South to Laguna Beach or North to his old home town, Santa Barbara.

Learn SAS
Jim Simon 9
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 3
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 3
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 8
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
Jim Simon 7
Importing CSV files into SAS datasets

Sometimes, your first impulse may not be correct, like trading in your practical sedan for a hot 2-seater.  Other times, your first impulse is perfect, as in the examples below. Suppose the automobile data you wish to analyze resides in a CSV file.  Naturally, your first impulse is to import

Jim Simon 0
Coding in the fast lane with data-driven macro calls

The simple PRINT macro below prints a selected dataset: %macro print(data=&syslast,obs=5); proc print data=&data(obs=&obs); title "%upcase(&data)"; run; %mend print; Suppose you want to print every dataset in the library.  Would you enjoy typing a macro call for every dataset in the library? Only if you enjoy coding in the slow

Learn SAS
Jim Simon 9
Time to trade in your jalopy macro?

Suppose you have an old jalopy that's perfectly reliable.  Your jalopy gets you where you wanna go: no frills; no drama. Do you trade your old wheels in for a racecar that accelerates like crazy and corners like it's on rails? Or stick with what's old and comfortable?   Your choice

Jim Simon 0
Don’t let your macros crash and burn

Your macro just crashed and burned.  So, what's the problem?  Let’s take a look: The text OR in the code above was misinterpreted as a logical operator.  To correct this issue, use the %STR function to protect (disable the normal meaning of) special characters and mnemonics in constant text: The

Jim Simon 6
SAS 9.3 macro SQL trick

Suppose you need to create a numbered series of macro variables, one macro variable per row, from an SQL query. Suppose you magically know in advance that a given WHERE clause returns, say, 123 rows.  No problem! proc sql; select customer_name into :name1-:name123 from orion.customer where country='DE'; quit; Now suppose you