Interview Questions   Tutorials   Discussions   Programs   Videos   

SAS - How can you get the single data set from the library(which has the number of data sets)?

asked mar September 20, 2014 06:28 AM  

How can you get the single data set from the library(which has the number of data sets)?


1 Answers

answered By vishnoiprem   0  

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 instead of the WHERE statement. This tip shows you how and when to apply the WHERE and IF statements to get correct and reliable results. It also reviews the similarities as well as the differences between these two SAS programming approaches. Detail differences in program efficiency between the two approaches will not be covered in this tip. The following code creates the sample data set that is used in the examples. The data set contains test scores of three classes from three students.

data exam;
   input name $ class $ score ;
 Tim math 9
 Tim history 8
 Tim science 7
 Sally math 10
 Sally science 7
 Sally history 10
 John math 8
 John history 8
 John science 9

Key Differences between WHERE and IF Conditions to Subset Data Sets Below is a table that summarizes the key differences between WHERE and IF Conditions

There is difference between how SAS handles IF and WHERE conditions. The 'WHERE' condition is applied on data before they enter Program Data Vector (PDV) and in case of 'IF' it is applied after data comes out from PDV. Now, if you have created a variable in the same data step using Where : the created variable will not be applied condition. IF: the created variable will be subjected to the condition applied

   add comment

Your answer

Join with account you already have



Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!