Friday, December 5, 2008

Meta data Creation

Meta data creation in clinical trials comes handy to see what kind of variables are currently in a dataset and its attributes with format name and its decodes.

It should be a straight forward code using the procedures proc contents and proc format with few data steps.

proc contents data=libname.dsname out=contents(keep=memname name type fmtname length label rename=(format=fmtname));
run;

proc format fmlib cntlout=formats(keep=format start label rename=(label=label1));
run;

Merge datasets you have got by fmtname. Include a dummy variable comment to write later on it if you have any specific comments about the same.

data metadata;
merge contents formats;
by fmtname;
comment="";
run;

proc print noobs label;
run;

Perspectives of Life Part1

Am I Bored with life? or am I not living how others would generally lead there life? Is that I am in some sort of attitude problems?Why I will be always in jitters and frenzied every morning?

These are the questions which are taunting me these days... I don't why..But I am sure that I am disturbed and when I sit down and think about the same, I would feel kind of stupid and, no I should n't think about anything in life and we have to accept just what ever we get! Well another paradox is if we(I) had such kind of notion of accepting things as they come then whats the purpose of concept of being motivated to work and accept the challenges in the life..

Well, I would always think why I should restrict myself for the mundane things but rather make some things which would really serve the purpose of my birth in this universe. Then it begs the question what are the real responsibilities and what's the thrilling junk we really impose on ourselves and keep on paying the cost to it.

I really won't understand the dynamics of my neural circuits. When I sit idle and start my self realization I would feel that what I am doing and what I am supposed to do are exactly contradicting. I have always felt from my deep sense of heart that I have to do some thing good as I had a great chance of being an intelligent species in this evolution. I owe some thing to this world and I am not sure what all the things I could do for this world?

Every morning when I woke up with my alarm ringing at 7:15 I would feel man! yet another day!! Why I have to count days for weekend? am I just waiting for just passing times for years?
If so how many years? If thats the case what we achieve being born as an intelligent animal.
Animals do have socializing behavior but not kind of a great reaction for the other animals suffering! If thats the case Vets would not have been in the business and humans in the name of fancy/support would not have raised pets(as its mom doesn't allow its pup to wean from her). Well, I am little off track, but the bottom line is that I am little weird in feeling sense of gratitude of being human and too much concerned about the human suffering( in all forms)?

Why I cant be like most of us who doesn't really care about whats happening in around them and just care what they would save for having a wealthy retirement! I pray for good to give me such kind of will that after I complete this blog I will be like any other selfish human being!!!

Monday, May 12, 2008

AE Summary Tables by SOC

Adverse Events Summary is one of the important tables generated in clincal trials industry.

Let us see how we could construct an AE table..

Important Points to remember:
1. AE Verbatim terms are to be coded with standard medical dictionaries, MeDRa.
2.SOC Name and Pt name are important variables that would be used for developing table.
3.Each Patient or Unique Patient Id is Counted only once for each of the SOC term and once for the Pt Name in each SOC term.

Code:

proc sort data=ae out=ae1;
by rand site ptid socname;
run;

proc sort data=ae out=ae2;
by rand site ptid socname ptname;
run;


proc freq data=ae1;
tables socname/out=ae1;
by rand;
run;

proc freq data=ae2;
tables socname*ptname/out=ae2;
by rand;
run;

Now set the datasets ae1 (with counts for soc term) and ae2 (with the counts for soc term *pt term) by soc term.

you would have the counts in each of the trt group(rand) for the soc term and pt term. Transpose the datasets or set accordingly to result in the counts for each of the trt group. Percents are calculated by using denominator N from the number of Patients enrolled(Like Demographics Dataset for ITT) and N from the number of Patients intended to treat from Randomization dataset for the safety analysis.

Friday, January 11, 2008

Detecting Outliers based on 99% quantiles

libname raw "PATH";

ods output Quantiles=quantiles;
proc univariate data=raw.clinic;
var height;
run;
ods output close;

data quantiles;
set quantiles;
where Quantile="99%";
run;


data final(drop=varname estimate);
retain estimate _estimate;
set quantiles raw.clinics;
if _n_=1 then _estimate=estimate;
if _n_=1 then delete;
if _estimate>height then output;
run;













































































run;

Wednesday, January 9, 2008

Sahara Saral..Sahara Pookal .. Song

THIS VARIABLE IS UNINITIALIZED

THIS VARIABLE IS UNINITIALIZED


Sometimes when one is coding a specified data set structure,
some of the variables will be uninitialized. This results in the SAS Log message similar to:

NOTE: Variable z is uninitialized.

This is not acceptable if one is a member of the “Clean SAS Log”
club.

data … ;
attrib

;
%* prevent NOTE: Variable ***** is uninitialized.
messages ;
retain _character_ ‘’ _numeric_ . ;
stop ;
run ;


Richard supplied the following caution for his trick: “Only use this
with impunity when creating a zero rowed table of desired structure
as set forth in prior attrib statements(s).”

Source:http://www.bassettconsulting.com/CC014.pdf

SAS Functions (an excerpt)

SAS FUNCTIONS
Arithmetic Functions
ABS(argument)
returns absolute value
DIM(array-name)
returns the number of elements in a one-dimensional array or the number of elements in a specified dimension of a multidimensional array.
n specifies the dimension, in a multidimensional array, for which you want to know the the number of elements.
DIM(array-name,bound-n)
returns the number of elements in a one-dimensional array or the number of elements in the specified dimension of a multidimensional array
bound-n specifies the dimension in a multidimensional array, for which you want to know the number of elements.
HBOUND(array-name)
returns the upper bound of an array
HBOUND(array-name,bound-n)
returns the upper bound of an array
LBOUND(array-name)
returns the lower bound of an array
LBOUND(array-name,bound-n)
returns the lower bound of an array
MAX(argument,argument, ...)
returns the largest value of the numeric arguments
MIN(argument,argument, ...)
returns the smallest value of the numeric arguments
MOD(argument-1, argument-2)
returns the remainder
SIGN(argument)
returns the sign of a value or 0
SQRT(argument)
returns the square root

Character Functions
BYTE(n)
returns one character in the ASCII or EBCDIC collating sequence where nis an integer representing a specific ASCII or EBCDIC character
COLLATE(start-position<,end-position>) (start-position<,,length>)
returns an ASCII or EBCDIC collating sequence character string
COMPBL(source)
removes multiple blanks between words in a character string
COMPRESS(source<,characters-to-remove>)
removes specific characters from a character string
DEQUOTE(argument)
removes quotation marks from a character value
INDEX(source,excerpt)
searches the source for the character string specified by the excerpt
INDEXC(source,excerpt-1<, ... excerpt-n>)
searches the source for any character present in the excerpt
INDEXW(source,excerpt)
searches the source for a specified pattern as a word
LEFT(argument)
left-aligns a SAS character string
LENGTH(argument)
returns the length of an argument
LOWCASE(argument)
converts all letters in an argument to lowercase
QUOTE(argument)
adds double quotation marks to a character value
RANK(x)
returns the position of a character in the ASCII or EBCDIC collating sequence
REPEAT(argument,n)
repeats a character expression
REVERSE(argument)
reverses a character expression
RIGHT(argument)
right-aligns a character expression
SCAN(argument,n<,delimiters>)
returns a given word from a character expression
SOUNDEX(argument)
encodes a string to facilitate searching
SUBSTR(argument,position<,n>)=characters-to-replace
replaces character value contents
var=SUBSTR(argument,position<,n>)
extracts a substring from an argument. (var is any valid SAS variable name.)
TRANSLATE(source,to-1,from-1<,...to-n,from-n>)
replaces specific characters in a character expression
TRANWRD(source,target,replacement)
replaces or removes all occurrences of a word in a character string
TRIM(argument)
removes trailing blanks from character expression and returns one blank if the expression is missing
TRIMN(argument)
removes trailing blanks from character expressions and returns a null string if the expression is missing
UPCASE(argument)
converts all letters in an argument to uppercase
VERIFY(source,excerpt-1<,...excerpt-n)
returns the position of the first character unique to an expression

Date and Time Functions
DATDIF(sdate,edate,basis)
returns the number of days between two dates
DATE()
returns the current date as a SAS date value
DATEJUL(julian-date)
converts a Julian date to a SAS date value
DATEPART(datetime)
extracts the date from a SAS datetime value
DATETIME()
returns the current date and time of day
DAY(date)
returns the day of the month from a SAS date value
DHMS(date,hour,minute,second)
returns a SAS datetime value from date, hour, minute, and second
HMS(hour,minute,second)
returns a SAS time value from hour, minute, and second
HOUR(