Created
January 26, 2015 23:34
-
-
Save joosti/a7d8688246012ce1afb0 to your computer and use it in GitHub Desktop.
SAS Macro variables in remote submit (rsubmit) using SYSLPUT
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
/* Making macro variables available on remote server with syslput */ | |
/* login to remote server */ | |
%let wrds = wrds.wharton.upenn.edu 4016;options comamid = TCP remote=WRDS; | |
signon username=_prompt_; | |
/* this macro retrieves Compustat Funda variables from year1 to year2 */ | |
%macro getFunda(dsout=, year1=2010, year2=2013, vars=); | |
/* syslput pushes macro variables to the remote connection */ | |
%syslput dsout = &dsout; | |
%syslput year1 = &year1; | |
%syslput year2 = &year2; | |
%syslput vars = &vars; | |
rsubmit; | |
%put Year1 value: &year1 - year2 value: &year2; | |
%put Collect variables &vars and create &dsout; | |
data a_funda (keep = gvkey fyear &vars); | |
set comp.funda; | |
if &year1 <= fyear <= year2; | |
if indfmt='INDL' and datafmt='STD' and popsrc='D' and consol='C' ; | |
run; | |
proc download data=a_funda out=&dsout; | |
endrsubmit; | |
%mend; | |
/* invoke */ | |
%getFunda(dsout=a_funda1, vars=at sale ceq); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment