Learn SAS programming, SAS tutorials, SAS video tutorials, SAS ebooks, SAS tips, SAS codes, SAS sample programs, SAS certification..
| Home | My Account | Directories |
SDTM Compliance Checks
Published on 2011-11-12 23:37:00
Validation checks or tools to check the compliance of SDTM data JANUS is a standard database model which is based on the CDISC’s SDTM standard. JANUS is used by the FDA to store the submitted SDTM clinical data. As a part of data definition file submission pharmaceutical companies have to submit SAS datasets in transport file (.xpt) format along with annotated CRF and Define.xml file. The reason being this is… to properly load the clinical data into JANUS database which is maintained b
How to remove carriage return and linefeed characters within quoted strings.
Published on 2011-10-27 15:23:00
HANDLING SPECIAL EMBEDDED CHARACTERS To manage and report data in DBMS that contains very long text fields is not easy. This can be frustrating if the text field has special embedded symbols such as tabs, carriage returns (‘OD’x ), line feeds (‘OA’x) and page breaks. But here is simple SAS code which takes care of those issues. The normal line end for Windows text files is a carriage return character or a line feed character so The syntax for taking out all carriage re
Counting the number of missing and non-missing values for each variable in a data set.
Published on 2011-10-13 09:19:00
/* create sample data */ data one; input a $ b $ c $ d e; cards; a . a 1 3 . b . 2 4 a a a . 5 . . b 3 5 a a a . 6 a a a . 7 a a a 2 8 ; run; /* create a format to group missing and non-missing */ proc format; value $missfmt ' '='missing' other='non-missing'; value missfmt .='missing' other='non-missing'; run; %macro lst(dsn); /** open dataset **/ %let dsid=%sysfunc(open(&dsn)); /** cnt will contain the number of variables in the dataset passed in **/ %let
When do I use a WHERE statement instead of an IF statement to subset a data set?
Published on 2011-08-17 09:07:00
When programming in SAS, there is almost always more than one way to accomplish a task. Beginning programmers may think that there is no difference between using the WHERE statement and the IF statement to subset your data set. Knowledgeable programmers know that depending on the situation, sometimes one statement is more appropriate than the other. For example, if your subset condition includes automatic variables or new variables created within the DATA step, then you must use the IF statement
Transporting SAS Files using Proc Copy and or Proc Cport/Proc Cimport
Published on 2011-07-04 10:36:00
When moving SAS datasets /catalogs from one type of computer to another, there are several things to be considered, such as the operating systems of the two computers, the versions of SAS and the type of communication link between the computers. The easiest way to move SAS datasets from one system to another system is to: Create a transport file using any SAS version.Move the transport file to the new system. Import the transport file on the new system. Transport datasets are 80-byte l
How to generate the month name from a numeric date value
Published on 2011-06-14 15:34:00
Task: I have a SAS date and wanted to create a variable with the month name. Here is how to do it...... Using MONNAMEw. format which is simple and easy. MONNAMEw. format is available in SAS 9.X versions. /*Use MONNAMEw. format*/ data month; input date:mmddyy8.; month_name=put(date,monname3.); datalines; 01/15/04 02/29/04 07/04/04 08/18/04 12/31/04;run; proc print; run; [[ This is a content summary only. Visit my website for full links, other content, and more! ]]
ERROR: The MS Excel table (worksheetname) has been opened for OUTPUT.
Published on 2011-06-14 14:38:00
I happend to stumbleupon a post from SAS support blog regarding the ERROR message in the LOG file when trying to output a SAS dataset in the form of Excel sheet. Direct link: ERROR: The MS Excel table (worksheetname) has been opened for OUTPUT. This table already exists, or there is a name conflict with an existing object. This table will not be replaced. This engine does not support the REPLACE option. ERROR: Export unsuccessful. See SAS Log for details. When you use the EXPO
How to read next record while working on the current record. (LEAD FUNCTION)
Published on 2011-02-06 14:08:00
Even though there is no function is available in SAS to do exactly the opposite work of the LAG function (i.e: reading the next record while working on the current one), there are few things you can do to do exactly that. Here are few simple techniques which are proved to work without any problem. *SAMPLE DATASET; data test; input id age grp ; datalines; 1 10 1 2 20 1 3 30 1 4 40 1 5 50 1 1 10 2 2 20 2 3 30 2 4 40 2 5 50 2 ; run; *1) Using the POINT feature
STUDY 'DAY' CLCULATION (ONE-LINER)
Published on 2011-01-22 12:21:00
Recently I stumbled upon a SUGI-Paper SAS 1-Liners by Stephen Hunt. I liked the way Stephen developed the 1-liner for STUDY DAY calculation. Direct link: One of the most common calculation used across all types of programming is determining a relative 'day' based on 2 date fields. In clinical trials the initial 'Study Day' is generally considered to begin at either randamization or dosing, thus assessments made prior to this starting point require a slight variation in the c
Easy way to UPCASE variable names of SAS dataset | StudySAS Blog [Digg]
Published on 2010-12-06 08:04:37
Upcasing the Variable names of the SAS dataset