Created
December 2, 2014 01:19
-
-
Save joosti/c0c902cf30ba32751e8a to your computer and use it in GitHub Desktop.
SAS Proc SQL Inner join
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| proc sql; | |
| create table work.dsOut as | |
| /* a.* means all records from work.dsIn | |
| b.effdate means select effdate from misc.sdc | |
| / | |
| select a.*, b.effdate | |
| from work.dsIn a | |
| /* perform a left join */ | |
| left join misc.sdc b | |
| /* require that gvkey is the same */ | |
| on a.gvkey = b.gvkey | |
| /* and that the effdate is in the 365 day period before datadate */ | |
| and a.datadate - 365 <= b.effdate <= a.datadate; | |
| quit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment