Posts

Proc Lifetest: Survival Analysis Using SAS

Survival Analysis using SAS :Advanced PROC LIFETEST Survival Part 1 Survival Part 2

Concatenation FUNCTIONS & CALL ROUTINES:

CATS/CATT/CATX Call Routines CAT/CATS/CATT/CATX Functions These Functions and Call Routines can be used to join two or more strings together. Even though we can use the concatenation operator in combination with the STRIP, TRIM, or LEFT functions, these functions make it much easier to put strings together and if you wish, to place one or more separator characters between the strings. One advantage of using the call routines than the functions is improved performance. Note: *Call routine executes faster than the function… in specific… CALL CATS: To concatenate two or more strings, removing both leading and trailing blanks. CATS () stands for concatenate and strip. Just think the ‘S’ at the end of the CATS as “Strip Blanks”. Syntax: CALL CATS (result, string-1<, string-n>); Example: A=”ABC’; B=” CONSULTING”; C=”INC “; D=” TEAM “; FUNCTION= RESULT CALL CATS(RESULT, A,B)= "ABCCONSULTING" CALL CATS(RESULT, A,B,C)= "ABCCONSULTINGINC" CALL CA...

Self Teach SAS tutorials

Image
SAS Tutorials The following are a series of self-teach tutorials which will introduce you to the command language approach to SAS programming. Each tutorial is designed to take about twenty minutes. To work through the tutorials you need to be on a machine which has SAS Version 8 loaded on it, or has access to SAS through the campus network. The material presented in the tutorials is designed to get you 'up and running.' Consequently, many options are omitted. Check the SAS help files for more a detailed discussion of the procedures outlined in the tutorials. The last tutorial is an introduction to SAS Analyst which is SAS's version of a 'point and click' approach to statistical analysis. Starting SAS under Windows Tutorial 1: Data Steps Part 1 Tutorial 2: Data Steps Part 2 Tutorial 3: Data Transformation and Selection Tutorial 4: Displaying the Data Tutorial 5: Some Basic Statistical Procedures SAS Analyst tutorial--interactive SAS SAS Multilevel Interactive d ire...

Clean-Up: Delete datasets in the work library:

It is better always to clean-up/empty the work directory before we run the next set of SAS code. This is VERY helpful in situations where the “working” files created tend to use up a large amount of memory, once the logic of the program has been checked, KILLing the working files will result in a more efficient program. Another important reason to issue the above statement at the end of a program is when programs are run in batch, this will clean up the working library to be sure any “old” files are not left around to be erroneously used1. PROC DATASETS procedure offers an elegant solution to do just. Remember that there is no need of knowing any dataset names when we are emptying the work directory. Here is the simple syntax: proc datasets lib=work kill nolist memtype=data; quit; We have specified lib=work, because we are cleaning up the work directory. KILL option removes all the datasets that are happened to be in the work directory. NOLIST option tells SAS, printing the details...

Comparing Two Methods for Removing Formats and Informats in SAS: DATA Step vs. PROC DATASETS

Comparing Two Approaches to Removing Formats and Informats in SAS Comparing Two Approaches to Removing Formats and Informats in SAS When working with SAS datasets, there are times when you need to remove formats and informats that have been previously assigned to variables. Two primary approaches can be used for this task: Using the DATA Step Using the PROC DATASETS Procedure This article compares and contrasts these two approaches to help you determine which method is most appropriate for your needs. Approach 1: Using the DATA Step The DATA step is a versatile and commonly used method for removing formats and informats. By assigning variables to a null format or informat, you can effectively remove these attributes from your dataset. Example: data mydata_clean; set mydata; format _all_; informat _all_; run; In this example, the mydata dataset is processed in the DATA step, and...

maxvarlen_macro: Check the Length of all character variables length is LT 200

MAXVARLEN Macro: According to FDA released the Guidance for Industry: Providing Regulatory Submission in Electronic Format – NDAs which was released in Jan 1999, one of the important point to comply with the agency’s regulations is : The length of any character values cannot be more than 200 characters. Here is the macro which will give us the list of character variables whose actual length (not the assigned) is greater than 200. You can use this program to check the maximum length of all variables of any dataset at once. This macro will create a table with list of variables and their length. ***********************************************************************; *** Program: macro_maxvarlen.sas ***; *** Version: 1.0 ***; *** Client: ***; *** Protocol: ***; *** Programmer: sarath Annapareddy ***; *** Date: 22APR2009 ***; *** Purpose: Macro used to check the list of variables whose ***; *** length is GT 200. ***; *** ***; **************************************************...

Proc Compare/Dictionary.Coulmns/Dictionary.Tables.: Program used to compare the SAS datasets in two directories

Image
Here is the new Proc compare.sas program, I have developed ....to compare all the datasets in 2 directories(testing and production) at once and to quick check any mismatches. Proc compare only check if there is any mismatches between the datasets in 2 directories. If any, it reports otherwise it will give us a note saying that: Note: No unequal Values were found. All values compared are exactly equal. See the proc compare snap shot: What if any dataset has the length more than 8, and what if any variable length more than 40 and what if the dataset name has more than 8 characters etc... Proc Compare doesn't address this issue. I have developed the following program to address this issue. It’s a mandatory that we need to follow certain requirements when we are preparing for an electronic submission to the FDA. The following are some of the QC checks FDA requirements: 1) The length of a dataset name & variable name shouldn’t be more than 8 characters. 2) The length data set labe...