42 data work.empdata;
43 merge work.employee work.salary;
44 by fname;
45 totsal + salary;
NOTE: There were 2 observations read from the data set WORK.EMPLOYEE.
NOTE: There were 3 observations read from the data set WORK.SALARY.
NOTE: The data set WORK.EMPDATA has 3 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
The statement merge employee (in=ine) salary(in=ins); performs a match merge based on the BY variable fname.
Here we have two observations in the SALARY dataset for variable fname value 'Bruce' so in the output dataset we have two records. For variable fname value 'Dan' we have one observation in the SALARY dataset so in the output dataset we have one record. A total of three records will be output.
The statement totsal + salary; will be processed as RETAIN totsal 0;
totsal = SUM(totsal,salary);. For each iteration, the value in totalsal will give the cumulative sum of salary on the record level.
Rajani Mar 27, 2015Abhi Apr 03, 2015WendyZ Dec 05, 2015nasirchem Dec 21, 2015
Bi Exam Academy
The one and only FREE resource for general SAS online training as well as study guides for the SAS Base Certification. My goal is to create the SAS Certification prep guide that I never found but always wanted. This should also be a place to come if you are new to the language but are simply looking for online SAS training.