Posts

Overview on CDISC Implementation

Image
CDISC Advantages CDISC has developed a set of data standards to enhance data collection, management, analysis, and reporting efficiencies, improve safety monitoring, and streamline the review and approval process for investigational treatments. Under the ICH’s electronic Common Technical Document (eCTD) guidance, CDISC Study Data Tabulation Model (SDTM) is the preferred standard for content format and structure of clinical data for all clinical studies. Based on proposed federal regulations, the FDA will mandate that all clinical trial submissions be in electronic format and that the content comply with data standards guidance. Veristat helps our clients by not only implementing these standards on a project or program, but also by providing our clients with an understanding of the CDISC standards. source:veristatinc.com   source: http://cro.businessdecision.com/ (' ’)

How to convert the datetime character string to SAS datetime value? (ANYDTDTM and MDYAMPM formats)

Image
When we have a string like this "9/01/2010 11:52:54 AM" and would like to translate the string to a numeric SAS date time variable, most of the times we use SCAN function to extract the information to get the DATETIME format. This is definitely a tedious job. SAS formats ( MDYAMPM, ANTDTDTM ) comes to rescue us. Here is how it works. data test ; length date $25 ; date=" 9/01/2010 11:52:54 AM "; *Convert the character string to SAS datetime value; datetimevar = input (date, mdyampm25.2 ); datetimevar1 = input (date, anydtdtm20. ); *Apply format to the SAS date time value; format datetimevar datetimevar1  datetime19. ; run ; Result: 01SEP2010:11:52:54 * ANYDTDTM and MDYAMPM informats work together when the datetime value has AM PM specified or day, month, and year components are not ambiguous. The MDYAMPMw . format writes datetime values with separators in the form mm/dd/yy hh:mm AM PM, and requires a space between the date and the time....

SAS Keyboard Shortcuts

Image
Here are the few shortcuts you need to know to speed up the code writing. These work in both EPG (Enterprise Guide) and SAS Enhanced Editor. Shortcuts and their descriptions: Remember that the keyboard shortcuts listed here are default. Selection Operations: 1) Comment the section with line comments (/): press CTL + / 2) Undo the comment: press CTL + SHIFT + / 3) Convert selected text to lowercase: press CTL + SHIFT + L 4) Convert selected text to uppercase: press CTL + SHIFT + U Shortcuts (pre-defined) CTRL+Shift+L or +U (only for the enhanced editor), which convert all selected text into lowercase or uppercase respectively. These become very handy  when we insert the text by copy+paste. 5) Indent selected section: press TAB 6) Un-indent selected section: press SHIFT + TAB 7) To move curser to the matching DO/END statement: press      ALT + [ or      ALT + { or        ALT+] or ...

Mastering Global and Local Macro Variables in SAS: Essential Techniques and Best Practices for SDTM Programmers

Mastering Global and Local Macro Variables in SAS: A Detailed Guide for SDTM Programmers Mastering Global and Local Macro Variables in SAS: A Detailed Guide for SDTM Programmers In SAS programming, especially when dealing with complex tasks such as SDTM (Study Data Tabulation Model) dataset creation, macro variables play a critical role in automating processes and managing large amounts of data efficiently. Understanding the distinction between Global and Local macro variables, and how to use them appropriately, is essential for writing clean, maintainable, and robust code. What are Macro Variables in SAS? Macro variables in SAS are placeholders that store text strings, which can be reused throughout your SAS programs. They are part of the SAS Macro Language and are used to make your code more dynamic and flexible. By using macro variables, you can avoid hardcoding values and make your code easier to modify and scale. There are two pri...

How to get the details of formats from the format libraries:

Image
If you are like me wanted to get the details of formats stored in the format library, here are two easy ways ….Proc catalog or Proc format Proc Catalog: Proc catalog will give us the details about name and type (numeric or character) of formats Syntax: proc catalog catalog = frmtdir.formats; contents ; run ; * FORMATS , is the name of the folder where all permanent formats are stored inside the library FRMTDIR . *If you want to get the details of temporary formats use WORK in place of frmtdir.formats; Proc Format: Use either SELECT or  EXCLUDE statements to choose the formats for which you want to get the details. Syntax: proc format library = frmtdir.formats; select locfmt; run ; This code will provide the details of LOCFMT in the FRMTDIR library. Below code gives complte information about what's stored in your format catalogs. libname frmtdir 'c:\saswork' ; proc format library =frmtdir.formats cntlout = formats; run ; Look at ...

Converting SAS datasets to SPSS

Image
If you want to view SAS dataset in SPSS you can use GET SAS command of SPSS. Here is the syntax; get sas data= 'C:\data\class.sas7bdat' . For conversion of SAS to SPSS we need to see if any formats assigned to variables in the dataset or not. If there are no formats then we just follow following steps to convert SAS dataset to SPSS. **STEP1: Creating .xpt file of a SAS dataset using Proc COPY.** libname SAS 'c:\sas\data\ '; libname SPSS xport 'c:\sas\data\class.xpt' ; proc copy in=sas out =spss; select class; run ; **STEP2: Use SPSS command to convert the transport format SAS file to SPSS;** You should use following commands to convert transport format file to SPSS data. get sas data='c:\sas\data\class.xpt'. execute. *******************************************************************************************; If there are formats then we need to convert the formats catalog to a SAS data set before converting the SAS dataset...

Delete observations from a SAS data set when all or most of variables has missing data

Image
/* Sample data set */ data missing; input n1 n2 n3 n4 n5 n6 n7 n8 c1 $ c2 $ c3 $ c4 $; datalines ; 1 . 1 . 1 . 1 4 a . c . 1 1 . . 2 . . 5 e . g h 1 . 1 . 3 . . 6 . . k i 1 . . . . . . . . . . . 1 . . . . . . . c . . . . . . . . . . . . . . . ; run; *If you want to delete observation  if the data for every variable is missing then use the following code; *Approach 1: Using the coalesce option inside the datastep; data drop_misobs; set missing; if missing(coalesce(of _numeric_)) and missing(coalesce(of _character_)) then delete ; run ;   Pros: *Simple code Cons; *This code doesn't work if we want to delete observation based on specific variables and not all of them. *Approach 2:Using N/NMISS option inside the datastep; data drop_missing; set missing; *Checks the Non missing values using ; if n(n1, n2, n3, n4, n5, n6, n7, n8, c1, c2, c3, c4)=0 then delete ; run; data drop_missing; set missing; *Checks the missing values us...