Many programmers neglect dropping unnecessary variables.Carrying these along places a double burden on resources.First,the data sets are larger and more storage space is needed to hold them temporarily or permanently.Second, since the data sets and accompanying PDVs are larger, more CPU time is needed to process them.
In this example you read in student answers to a test (a multiple-choice test on SAS programming, perhaps) and compute a raw and percentage score for each student. You want a data set containing only raw and percentage scores for further analysis.The method you use, however, requires other intermediate variables to be created along the way. Compare the two following sets of code very closely. The second program has one very small addition which makes one very large difference.
Example – INEFFICIENTDATA SCORE;
The variables KEY1-KEY5, Q1-Q5,and the DO loop counter I are key to the method used to derive the final scores, but they are extra baggage after they have served their purpose. Why keep them around?
Example – EFFICIENTDATA SCORE;
That little KEEP (or DROP) statement makes the difference.The efficient program in this example uses only 16 bytes of storage for each observation, while the inefficient program wastes 5 bytes for each of the KEY1-KEY5 and Q1-Q5 variables, plus an extra 8 bytes for the DO loop counter.
You should (almost) always remember to drop DO loop counters (I in this example) since they will (almost) never be of use. You may want to refer to, "RETAIN," for an explanation of a similar program.The point here is merely to remember to drop unnecessary variables.
SAS Programming Related Tutorials
|SASS (Syntactically Awesome Style sheets) Tutorial||R Programming language Tutorial|
SAS Programming Related Interview Questions
|Logistics Interview Questions||SAS Programming,SQL server Interview Questions|
|Clinical SAS Interview Questions||SASS (Syntactically Awesome Style sheets) Interview Questions|
|SQL Server Analysis Services (SSAS) Interview Questions||R Programming language Interview Questions|
|SAS DI Interview Questions||Advanced SAS Interview Questions|
|Base Sas Interview Questions||SAS Macro Interview Questions|
|Clinical Data Management Interview Questions|
Sas Programming Tutorial
Input And Infile
Set, Merge, And Update
Table Lookup Tools
Proc Means And Proc Uimivariate
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.