Tuesday, June 23, 2009

SAS REPORTER: Download SAS ebooks,certification questions and other study material

NOTE-->ACCESS TO THIS LINK IS BY INVITATION ONLY.PLEASE LEAVE YOU MAIL-ID AND YOU WILL RECEIVE AN INVITATION TO ACCESS THE LINK.
THANK YOU.

SAS REPORTER: Download SAS ebooks,certification questions and other study material
NOTE-->ACCESS TO THIS LINK IS BY INVITATION ONLY.PLEASE LEAVE YOU MAIL-ID AND YOU WILL RECEIVE AN INVITATION TO ACCESS THE LINK.
THANK YOU.

How To Remove Duplicate Records In A Dataset?



Lets create a dataset-m arks

/*reading dataset from external file in temporary libary*/
data marks;
infile 'c:\users\bobby\desktop\marks.txt';
input id gender$ marks_m1 marks_m2;
/*sending output*/
proc print;
run;

sas output of the dataset marks is—

id gender marks_m1 marks_m2

1 m 50 50
1 m 50 50
2 f 60 65
2 f 70 70
3 f 80 70
3 f 90 70
3 f 80 80
4 m 85 60
5 m 90 60
5 m 90 90
5 m 70 100
6 f 75 80
6 f 75 80
7 m 80 80
8 m 90 70
9 m 90 70
9 m 90 80
10 f 60 70
10 f 90 80

As you can see that there are duplicate records in the dataset.few records are identical (all values same) while others with id but other values different.let us see how we can eliminate them…



/*eliminating duplicate records*/
/*using nodupkey options*/
proc sort data=marks out=no_dup nodupkey ;
by id;
run;
/*using dupkey option of proc sort deleted duplicate observations/records with same key
variable/by variable*/

proc print data=no_dup noobs;
run;


output of no_dup dataset—



id gender marks_m1 marks_m2

1 m 50 50
2 f 60 65
3 f 80 70
4 m 85 60
5 m 90 60
6 f 75 80
7 m 80 80
8 m 90 70
9 m 90 70
10 f 60 70

We have used the nodupkey option of proc sort which deleted records with same value of key variable(id in this case).

Now ,there is other option to eliminate duplicate rows ..
The ‘noduprecs’ option ….this option is useful when we want to delete identical records.

proc sort data=marks out=no_dup noduprecs ;
by id;
run;


id gender marks_m1 marks_m2

1 m 50 50
2 f 60 65
2 f 70 70
3 f 80 70
3 f 90 70
3 f 80 80
4 m 85 60
5 m 90 60
5 m 90 90
5 m 70 100
6 f 75 80
7 m 80 80
8 m 90 70
9 m 90 70
9 m 90 80
10 f 60 70
10 f 90 80



/*in the output we see that there are still observations/records with duplicate keyword
,this is where noduprecs differs from nodupkey.
nodupkey eliminates records where it detects repeated by varialbe value whereas noduprecs
deletes only identical records i.e where all values are exactly the same*/


*warning when using nodeprecs*/
/*though noduprecs deletes records with identical values but still there are cases when it
deviates from its normal working...let us see in the following example--*/..

the given dataset is…


id height weight

1 123 45
1 124 56
1 123 45
1 125 68

Two records are identical.to remove second record we use nodeprecs option..the output is…

Obs id height weight

1 1 123 45
2 1 124 56
3 1 123 45
4 1 125 68

/*here in the output you can see the duplicate still exists,this is where you need to be cautious,
thing to remember is that noduprecs deletes only successive duplicates .*/
one way to solve this situation is to consider more than one variable in by statement to make sure that identical records are successive.

Monday, June 22, 2009

SAS:Concepts And Questions

Question1:-

HOW TO OBTAIN LAST N OBS FROM A SAS DATASET IF WE DON'T KNOW THE NUMBER OF OBS..?

Sol-:
If you want to obtain last 5 obs (or n obs) then here is a simple way of doing -

data last_five;
set input_data nobs = t_obs;

if _n_ gt (t_obs - 5) then output last_five;

run;
(first answered by-anonymous,SAS orkut community)

Question2:-
WHAT IS THE AUTOMATIC VARIABLE _N_ DOES IN SAS?

A)COUNTS THE NUMBE OF OBSERVATIONS IN DATASET
B)COUNTS THE ITERATIONS OF DATASTEP

Sol-:
viks only (b) is always correct. some time no. of iterations of datastep is equal of no. of observations in dataset.

let see this code......

data madhur;
input ......; /* team is third variable in datalines*/

datalines;
1023 David red 189 165
1049 Amelia yellow 145 124
1219 Alan red 210 192
1246 Ravi yellow 194 177
1078 Ashley red 127 118
1221 Jim yellow 220 .
;

proc print data=madhur;
run;

u see in this code output dataset (madhur) will have 6 observations and datastep also iterate 6 times to write these 6 observations into output dataset madhur.

now see same code with subsetting if statement.


data madhur;
input ......; /* team is third variable in datalines*/
if Team='red';

datalines;
1023 David red 189 165
1049 Amelia yellow 145 124
1219 Alan red 210 192
1246 Ravi yellow 194 177
1078 Ashley red 127 118
1221 Jim yellow 220 .
;

proc print data=madhur;
run;

u see in this code output dataset madhur will have 3 observations ( due to subsetting if statement ) but datastep has to iterate 6 times to select 3 observations ( for which the values of team is red ).

(first answered by-manu,SAS orkut community)


Question3:-
CAN U TELL THE OUTPUT OF THE FOLLOWING CODE-

Data Data1;
Test='X';
Select(Test);
When('Y') Name='Viks';
When('X') Name='Viks@Home';
When('Z') Name='Other';
Otherwise Name='Unknown';
End;
Run;

What Is The Reason For This Output?
Plz Answer Without Running In Sas...U May Chk In Sas After U Answer.

Sol-:
without running i guessed the answer to be : 'viks@home'

but length of variable screwed up the answer. coz a statement before that (when('y)) set the length to be $4. in the same statment if u use [ length name $10. ] u will get name='viks@home'.

(first answered by-Varun Joshi,SAS orkut community)

Question4:-
write code to reverse order of observations in a dataset.
e.g. if a dataset has following observations:
ID Name color height weight
---------------------------------
1023 David red 189 165
1049 Amelia yellow 145 124
1219 Alan red 210 192
1246 Ravi yellow 194 177
1078 Ashley red 127 118
1221 Jim yellow 220 .

output should have David at last and Jim in first place. (assume data is not sorted in any key: means don't use descending sort)


Sol-:
data raw;
srt_var=_n_;
input id name$ color$ height weight;
datalines;
1023 David red 189 165
1049 Amelia yellow 145 124
1219 Alan red 210 192
1246 Ravi yellow 194 177
1078 Ashley red 127 118
1221 Jim yellow 220 .
;
run;

proc sort data=raw out=rev(drop=srt_var);by descending srt_var;run;

proc print data=rev noobs;run;

(answered by-Varun Joshi,Sas orkut community)

Saturday, June 20, 2009

Career in Clinical Research


source-TIMES OF INDIA(ASCENT/FEATURES)
BY-PRUYA NAIR
Posted On Wednesday, June 10, 2009 at 04:34:20 PM

India is fast becoming the global hub of clinical research opening up newer avenues for science graduates in this field. Here’s a look at what it takes to enter into this promising sector


Clinical research is a systematic study of the effects, risks, efficacy and benefits of a new drug. These studies are conducted at various stages both prior to the launch of a medicine in the market and after the launch of a new medicine to monitor safety and side effects of it. And, in India, clinical research sector is on a high growth path with huge spends coming in from developed countries. According to an estimation study by McKinsey, European and US pharmaceutical companies will spend US $1.5bn per year on clinical trials in India by the year 2010.


“A good knowledge about clinical practices and regulatory issues and good management and communication skills are also important for a clinical research professional," - D Saharsh Rao, president, Contract Research, Neuland Laboratories Limited
Many factors make India a popular destination for clinical research. “Well-trained medical communities that meet the global standards, huge patient base, large and fast growing private healthcare sector, state-of-the-art hospital facilities, lower costs for conducting trials, diversity in gene pool etc are few factors favoring clinical research,” explains D Saharsh Rao, president, Contract Research, Neuland Laboratories Limited.

Opportunities galore

According to experts, there are many opportunities waiting to be explored in this field. “Important clinical research outsourcing works happening in India are in the field of regulatory services, pre-clinical services, laboratory services, biometric services, drug interaction, proof of concept, conducting phase II – IV clinical trials on new medical interventions in various therapeutic areas such as infectious diseases (including Malaria & Typhoid fever), Oncology (breast cancer), cardiovascular diseases (hypertension, heart failure), psychiatry, respiratory diseases (asthma, bronchitis) and metabolic diseases (osteoporosis),” explains R Chelvi, Director, Mithas Labs Clinical Trials Research Foundation Pvt Ltd.

When many industries across sectors are reeling under the pressure of economic recession, the recession has not had much affect on clinical research. According to industry experts the industry is on a high growth path and it would require around 50000 professionals by 2010.

Job opportunities in this sector are as Clinical research Associates, Clinical research co-coordinators, Project managers, Principal investigators, Laboratory analysts, Clinical data Managers, Data Archivist, Quality Assurance/Quality Control, Medical writers, Data entry operators, SAS analysts, Biostatisticians etc. Also, there are opportunities in human resources, finance and business development in this sector.

Do you have it?

So what are the essential requirements to get into this growing sector? Dr Shilpa S Puthran, HOD – Clinical Research & Immunochemistry, Metropolis Health Services (India) Ltd explains a graduate in science or a medical professional can enter into clinical research. “A certificate or diploma in clinical research from any recognised institute including Institute of Clinical Research (ICRI), Clinical Research Education and Management Academy (CREMA), Manipal institute of clinical research etc can add more value,” adds Puthran. Adding to it Rao says, “A good knowledge about clinical practices and regulatory issues and good management and communication skills are also important for a clinical research professional.”

Lack of experience is not a barrier to seek a career in this sector as many organisations absorb freshers and provide them on the job training to make them competent enough. Taking advantage of the cost effectiveness and competent work force an increasing number of multinationals are outsourcing their clinical trials to India, making a career in clinical research a safe bet for many aspirants.

Sunday, June 7, 2009

Download SAS ebooks,certification questions and other study material

visit the following webpage for sas ebooks,certification materials.you can leave ur comments if u did not find the book you were looking for.
http://fb.esnips.com/web/bobbytobbysStuff

Friday, June 5, 2009

How to obtain laast n observations from the dataset

how to obtain last ‘n’ observation from a dataset—


The step to obtain last observation can be done in data step by using the following code since there are no options for obtaining last ‘n’ observations (like obs which indicates last obs to be read starting from first and firstobs which indicates starting obs , there is no lastobs option which takes us to the last starting from any observation in between)

data data1;
set vikas.health_data nobs=tot;


if _n_ gt( tot-5) then output data1;
run;
outputs—

Obs subj dob visitdate lastdate age agetoday

1 011 21FEB1980 16APR1960 28OCT2001 25 13
2 012 18MAY1981 19MAY1963 20DEC2000 24 12
3 013 24JAN1983 21JUN1964 21SEP2000 22 10
4 014 25SEP1984 25OCT1968 23OCT2003 21 9
5 015 05NOV1976 27NOV1970 24NOV2006 29 17

How To obtain first n observaton in the dataset

we have the following dataset(vikas.health_data)


The SAS System 2

Obs subj dob visitdate lastdate age agetoday

1 001 21OCT1950 12MAY2003 01DEC2004 55 43
2 002 12SEP1955 10FEB1984 24MAR2002 50 38
3 003 21MAR1965 12SEP1987 25JAN2000 40 28
4 004 02AUG1975 13OCT1975 29DEC1999 30 18
5 005 04FEB1985 21AUG1980 20OCT1998 20 8
6 006 11OCT1980 10JAN1955 23MAR2001 25 13
7 007 15OCT1981 09MAR1950 12MAY2002 24 12
8 008 24OCT1956 06APR1970 01JUL2003 49 37
9 009 12JUN1954 17SEP1988 12AUG2003 51 39
10 010 16JUL1952 21FEB1955 13SEP2000 53 41
11 011 21FEB1980 16APR1960 28OCT2001 25 13
12 012 18MAY1981 19MAY1963 20DEC2000 24 12
13 013 24JAN1983 21JUN1964 21SEP2000 22 10
14 014 25SEP1984 25OCT1968 23OCT2003 21 9
15 015 05NOV1976 27NOV1970 24NOV2006 29 17


Let us suppose that you have a dataset having thousands of observation and you want to display only first few observation to save processing resources and time…
suppose the given data set is above ….it is having 15 observations.
now if we want only first 10 obs then we can use the foeelowing code in for the proc print –


proc print data=vikas.health_data (obs=10) ;
run;

the option ‘obs’ tells sas to read till 10 th observation.
Similarly , the code

proc print data=vikas.health_data ( firstobs=5 obs=10) ;
run;

outputs the observations from 5 to 10th in the dataset health_data stored in the library named vikas.

Tuesday, June 2, 2009

How to diplay Page Number IN ODS output



How to display pageno in output header in format ‘page x of y’ in ods —
Well this is pretty easy and can be done using the title statement itself.This always works in RTF but may not work in pdf and html..
Note the use of ods ecsapechar statement .The escapechar(or escapecharacter)is used to convey information to ods as which symbol is to be used as escapecharacter.we can use any special character as escapecharater eg #,~ etc….

ods listing close;
ods escapechar='^';
title1 "Page ^{thispage} of ^{lastpage}";
ods rtf file='c:\users\bobby\desktop\file.rtf';
ods pdf file='c:\users\bobby\desktop\file.pdf';
Proc print data=sasuser.admit n='total obs=';
Run;
ods _all_ close;
ods listing;

Monday, June 1, 2009

how to add labels to column names


The task requires adding the label option of proc print-
You can see that ‘patient’ has been replaced as ‘patient name ‘

proc print data=data1 label;
label name='patient name';
run;

How to display the number of observations in output-

let us print the number of obs using proc print option-
options nodate nopage;
data data1;
set sasuser.admit;
run;
proc print data=data1 n='total obs=';
run;

Send link to --

TopBlogDir.blogspot.com button Education Blog Directory Academic,  Learning & Educational Blogs - Blog Catalog Blog Directory SEO Court Directory myblog Visit blogadda.com to discover Indian blogs Add to Technorati Favorites Subscribe with Bloglines DigNow.net

Join My Community at MyBloglog!

Free Web Directory - Add Your Link
The Little Web Directory
Monster Directory A List Sites