A warning about coding following someone else's examples:
@dleighton wrote:
@Reeza
That is extremely helpful! In the part of the code that our professor posted it included:
Data assumps;
set assumps;
absresid = abs(resid);
Run;
Please be extremely cautious, I would recommend almost never, use the code structure Data datasetname; Set datasetname;
The step replaces the original data. Depending on possible code logic errors (high probability when learning a programming language) or typos it is very easy to destroy your original data. If you use this approach you should make sure that you can always get back to the original data. One example from code I inherited involved recodeing data from a 1 and 2 value coding to a 0 and 1.
data example;
set example;
var = var -1;
/* other code was here*/
run;
Looks simple and much like your professor's example. However the code had a change needed in the "other code" indicated above. So the change was made and rerun. Now the values that had been 2, after the FIRST pass were reduced to 1 and with the second pass further reduced to 0. So all values of var became either missing or 0.
You have been warned. Less obvious are if the codes switch 0 to 1 and 1 to 0 (which I also inherited). That resulted in the rate of a reportable item changing from 56 percent to 44 percent and everyone in the organization thought there had been a drastic change from the previous year 55 percent.
... View more