Friday, January 1, 2010

20 SAS Macros Tips in 30 Minutes

20 SAS Macros Tips in 30 Minutes

Need to convert SDTM data to ADaM data? Here's How

Need to convert SDTM data to ADaM data? Here's (Clinplus Report)





Introduction


If you have you been wondering how you can effectively meet the clinical data study standards set out by the Clinical Data Interchange Standards Consortium (CDISC) specifically with regards to the Study Data Tabulation Module (SDTM) and the Analysis Data Model (ADaM) our data conversion and reporting tool may be the solution you are looking for to generate all of your safety tables and listings and provide supporting documentation in a validated, standardized ADaM compliant manner.



A Taste of SDTM in Real Time



Do we need to create ADaM dataset for each SDTM dataset?

By Jack Shostak:

You do not need to create an analysis dataset for every SDTM domain. The SDTM files can be used as-is (and probably with support from ADSL for key analysis variables) for statistical analysis if you can get away with that. The idea with analysis datasets and ADaM is that ADaM datasets are value added. ADaM doesn't want to create busywork for you. The top of page 9 of the draft ADaM 2.1 document touches on this question a bit, but not explicitly.




Thanks to Jack Shostak

ADaM Datasets VS SDTM Datasets:


Wednesday, December 30, 2009

SAS® Programming Guidelines

This paper presents a set of programming guidelines and conventions that can be considered in developing code to ensure that it is clear, efficient, transferable and maintainable. These are not hard and fast rules but they are generally accepted good programming practices. These techniques can be used in all types of SAS® programs, on all platforms, by beginners and experts alike.



SAS ® PROGRAM EFFICIENCY FOR BEGINNERS


Guidelines for Coding of SAS® Programs

Monday, December 28, 2009

David Franklin's SAS Tips

2009

November - Looping the loop with DO loops
October - The Use and Abuse of the NODUPKEY option in the SORT Procedure
September - Comparing all datasets in one directory against all the datasets in a second dataset, using CALL EXECUTE
August - Selecting data for a particular month
July - I am missing a '0' in front of my day value, can SAS still read it okay? (or can SAS read a text date of '6JUN2009' correctly)
June - Prefixing a value with '+' or '-'
May - Why use dataset variable labels?
April - More on using a FORMAT to merge data
March - Delete all datasets in a library, except ...
February - Getting rid of the message "NOTE: BASE data set does not exist. DATA file is being copied to BASE file."
January - SUM(OF variables)


2008


December - Making a copy of a SAS dataset, Part 2
November - How would I set only character or numeric variables of an observation to missing?
October - Making a copy of a SAS dataset, Part 1
September - Character to Numeric Conversion
August - Numeric to Character Conversion
July - How would I set all variables of an observation to missing?
June - Making a SAS Transport File
May - Creating a Batch File
April - Transposing the data and label
March - Get a listing of all the SAS programs for a particular directory
February - Enclosing a negative value within brackets
January - Stripping (text)

2007

December - The CALL MISSING Routine
November - The MISSING function
October - Renaming a SAS dataset variable
September - Since when does a null string have a length of 1?
August - I just received a dataset with the dates in dd/mm/yy format but I want them in mm/dd/yy format for my report
July - The COLLATE function
June - PROC MEANS vs PROC SUMMARY
May - What SAS modules are on your system, and how to work around those that are missing
April - Removing labels and formats from all variables inside a dataset
March - Deleting old datasets using a date
February - The trig functions
January - FLOOR, CEIL, ROUND and INT

2006

December - Creating a graph using ODS RTF
November - Using the DHMS function to create a datetime value
October - Using CARDS or DATALINES to input data
September - FORMCHAR
August - Does the string contain a number?
July - LOWCASE/UPCASE/PROPCASE
June - Why use DATA _NULL_
May - Does x+y = SUM(x,y), revisited
April - Six ways to make your program run faster
March - SQL and the CALCULATED keyword
February - TRIM and TRIMN
January - Four Common Ways to Merge Two Datasets

2005

December - The CANCEL option in the RUN command
November - The DIM function for repeating the same action of different variables
October - The COMPARE function
September - Getting the last word in a string using SAS or Excel
August - Using SASHELP.VMACRO to view your macro variables, and %SYMDEL to delete them
July - Deleting a SAS dataset, revisited
June - Using PROC CHART to do a quick frequency analysis
May - The Variance results from SAS and Excel are different!
April - Finding a duplicate key record, Part II
March - The 2005 Conference Season begins
February - Sometimes, overwriting a dataset does not replace it
January - How does SAS store your date and/or time?

2004

December - Does x+y = SUM(x,y)?
November - An example of some unexpected results
October - Does a macro variable exist in your program?
September - Adding a value to an existing format
August - Common Mathematical Operators
July - Getting the background color from an Excel Worksheet cell
June - BYTE/RANK (this is not eating a hamburger)
May - The 2004 Conference Season begins
April - Getting a Cell Comment inside an Excel Worksheet
March - Finding a duplicate key record
February - FIRSTOBS=, OBS=
January - A BAT to create a Backup of your file

2003

December - SAS and Excel do not compute the same quartile value
November - Using a format to group basic statistical analysis
October - Coding a missing value
September - Sometimes your System Command Call within SAS does not work
August - COMPRESS or COMPBL, that is the question
July - Placing Unique values from a dataset into a macro variable
June - Share your datasets with others, consider the SASViewer
May - INDEX, INDEXW and INDEXC
April - Deleting a SAS dataset
March - Helping a SORT run faster
February - To avoid confusion, define the variables you create in a datastep
January - Introduction/Have a notebook handy

Sunday, December 27, 2009

How to do a many-to-many merge in SAS without using SQL;

A many-to-many match-merge is more complicated. When we try to do many-to-many merge that means both the data sets have multiple occurrences of BY variable values. Simple match-merge the two data sets using the BY statement is never OK… Because when we do, we get the following note in the log.
"NOTE: MERGE statement has more than one data set with repeats of BY values."


SAS Programmer always tries to avoid this message in the log file….because this message means that the resulting data set is probably not what we expected.

Don’t be afraid that there is no way… you can do many-to-many merge using data step. A well known SAS Expert David Franklin points out a way to do many-to-many merge





Many Thanks David!

(Read his original post here)


NS8PO19P

The Fundamentals of MERGE

Wednesday, December 16, 2009

You can get the SAS Code back even If you haven’t saved it

If you happen to be one of the unlucky programmers who lost the SAS code … because you didn’t save it. There is solution for that…. SAS System automatically takes the backup of the SAS code for every 10 minutes (default);

Just look in the following location:

C:\Documents and Settings\Programmer Name\Application Data\SAS\EnhancedEditor\

Note: Replace “Programmer Name” with your login user id of the System you are using;
If you go the specified location above, you will see a copy of the unsaved version of the SAS code.
It will be quick if you search files with the extension name ‘.$AS’ (extension for auto-saved SAS codes)


If you want, you can also change the 10-minute time interval for Auto save…. Go to…


Tools Options Preferences Edit.


In the preferences dialog box, make sure to the change the time under Autosave every …. And click on OK ...