Language : sas

Title User Language Tags Description Date
Using character values on a macro %DO loop webonomic SAS

This sample contains 2 macro techniques for iterating through character values on a macro %DO loop.

June 11
person age function csrsen SAS

For proper calculation of human age using DOB and an as-of date.

February 27
Co Word Analysis with SAS webonomic SAS

Text Miner uses a compressed representation of the term-by-doc frequency matrix. You will find an OUT data set in the project data directory of your text miner run. Its label will include the string "OUT" in it. Since a 30,000 document collection will have as many as 500,000 to a million distinct terms, be sure to restrict your terms of interest with a start list. I give an example of creating the cooccurrence matrix with the following code which expands the compressed version to an uncompressed version and then computes the co-occurrence count with proc corr and the sscp option.

December 2
Using Alternating Background Color with PROC REPORT webonomic SAS

Adding alternating row of color to make proc report output easier to read.

November 2
Specify colors in SAS statistical graphics procedures webonomic SAS

If you want to see some of the color names that SAS recognizes, run the following statements, which will print a list of colors to the SAS log:

October 24
Default Macro Values webonomic SAS

Quite often it is necessary to set a default value for a macro parameter that is passed to a program. If the program is a macro, the %IF statement can be used to check if the value is provided and provide a default value if not. Since %IF statements are not allowed outside of macros, that technique won't work for a non-macro program (e.g., a file/program that is %INCLUDEd). The following code snippet demonstrates the use of the COALESCEC function to assign a default value.

since macro is a text manipulation facility, the coalesceC function is used regardless of whether the expected value for the parameter is numeric (i.e., everything in macro is interpretted as a character string).

October 13
Ods Html Report Pavonz SAS

Ods Html Report

July 14, 2012
Creating a report of Twitter hashtag activity webonomic SAS

The program uses the XML LIBNAME engine, FILENAME URL, SGPLOT procedure, and a simple PROC PRINT to create a report of recent Twitter activity around a specified hashtag.

April 13, 2012
[SAS] ETL Email Noticiation ccw SAS

An example to notify users with ETL job status

March 29, 2012
[SAS] JSON output ccw SAS

SAS code to output in JSON format

March 26, 2012
[SAS] Applying ACT ccw SAS

Applying Access Control Template to specific objects

March 26, 2012
Selecting a Random Sample of Observations webonomic SAS

You can use the POINT option of the SET statement to efficiently select a random sample of observations from a SAS data set. In addiiton to any statistical reasons for drawing a random sample, the technique is also useful to create test data from a large file. The program shown here efficiently samples a large data set. It reads only the observations that have been selected using the POINT option. You assign a variable that is the desired sample size. The example here selects a 10% sample. You can also assign a fixed value (e.g., 100). The DO loop is iterated for each observation The uniform function is compared to the percent of observations still to be selected If the observation is selected, it is read and output and the number needed is decremented by 1 Regardless the number of observations left is reduced by 1 The STOP statement is very important as without it, the DATA step will enter an infinite loop. This technique works by modifying the threshold as observations are read and selected. Every observation has the same probability of being selected so the technique is statistically valid (If you are a statistician, you probably know this. If not, the analogy of drawing straws is the logic behind this.)

February 16, 2012
Convert SAS dataset to Text file webonomic SAS

This SAS macro will convert a dataset to a text file

November 15, 2011
Create new folder with simple checks rambles SAS November 2, 2011
Text to SAS Variable Name rambles SAS

Useful functions to ensure (99% of the time...) that a piece of text can be used to name a SAS variable. NOTE: This won't work with SAS literals.

September 13, 2011