Professional Documents
Culture Documents
Credit Risk Model Monitoring
Credit Risk Model Monitoring
data newdata;
merge yourdata (in=a) otherdata (in=b);
by permno date;
/* note by variables are in the same order */
/* as the sort by variables) */
/* below this, you write your control statement,
one of the following */
if a;
if b;
if a and b;
if not a;
if not b;
Typical problems
• If both datasets were complete (they both have the same
observed units, then the IF statements would be unnecessary; "if
a and b" would be equivalent to leaving the statement out
altogether)
• If you do not have a BY statement (no identifier -- you somehow
know that each row of one datasets corresponds to the same one
row in the other dataset), the datasets are just "glued" side-by-
side.
• Common mishaps: the by variables have different formats across
datasets, SAS will merge the datasets, but will put a WARNING
in the log. Another common mishap is to have variables with the
same name (that are not the ID) -- one of the will be overwritten.
References
Good references are
• http://ftp.sas.com/techsup/download/technote/ts64
4.html
• and a manual called "Combining and modifying
SAS data sets: examples", which is in the RC
library. It has a lot of example. Unfortunately, it
does not exist in an online version (only the code
is available, but the explanations are very good).