Key says answer is option A, But according to my knowledge its for range of character variables so( Option D).
Please anyone clarify.
Thanks
Given a SAS data set with the following characteristics:
200 million observations
300 variables
Compressed
Resides on a network location
A SAS DATA Step program is written that will retrieve 20% of the data using a search based on a range of a character variable.
Which type of statement is the best choice to minimize computer resource utilization when subsetting this data?
A. KEEP/DROP
B. WHERE
C. CASE
D. IF/THEN/ELSE
I agree with @Reeza.
Supposing the question means what it seems to imply, the answer would be
where VAR between 'A' and 'B';
You need a new source for questions. You get what you pay for sometimes.
A is not correct and D would not be my guess.
@Prasad84 wrote:
Key says answer is option A, But according to my knowledge its for range of character variables so( Option D).
Please anyone clarify.
Thanks
Given a SAS data set with the following characteristics:
200 million observations
300 variables
Compressed
Resides on a network location
A SAS DATA Step program is written that will retrieve 20% of the data using a search based on a range of a character variable.
Which type of statement is the best choice to minimize computer resource utilization when subsetting this data?
A. KEEP/DROP
B. WHERE
C. CASE
D. IF/THEN/ELSE
I agree with @Reeza.
Supposing the question means what it seems to imply, the answer would be
where VAR between 'A' and 'B';
Ha, that's the theory. If only things were that simple.
In fact WHERE clauses are a bit faster than IF tests when simple (equality or inequality) value validations are performed.
But they are slower when functions are used.
16741 data TEST;
16742 do I=1 to 1e8;
16743 output;
16744 end;
16745 run;
16746 data _null_;
16747 set TEST;
16748 if I=1;
16749 run;
real time 5.21 seconds
16750 data _null_;
16751 set TEST;
16752 where I=1;
16753 run;
real time 4.73 seconds
16754 data _null_;
16755 set TEST;
16756 if round(I)=1;
16757 run;
real time 8.40 seconds
16758 data _null_;
16759 set TEST;
16760 where round(I)=1;
16761 run;
real time 16.07 seconds
In this simple test on my PC, WHERE is 10% faster than IF for an equality validation, but 100% slower if a function is used.
I only uncovered these variations last year, and will have to update the third edition of my book.
It looks as if functions compiled as part of the data step are more efficient than functions that process the data buffer before the PDV is loaded.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.