[R] Paasing values to sqlQuery like SAS macro
ramoss
ramine.mossadegh at finra.org
Thu Sep 13 23:18:24 CEST 2012
Thanks I was doing something similar in SAS. I was looping macro based on a
dataset containing the values:
data _null_;
set summary2;
mindat=put(datepart(mindate),date9.);
min_date='mindat_'|| trim(left(_n_));
put mindate= mindat= min_date=; /*check values in log*/
call symput (min_date,compress("'"||mindat||"'"));
maxdat=put(datepart(maxdate),date9.);
max_date='maxdat_'|| trim(left(_n_));
call symput (max_date,compress("'"||maxdat||"'"));
var_name='firm_' || trim(left(_n_));
put var_name= firm=;
call symput (var_name,compress("'"||firm||"'"));
call symput ('total_obs',_n_);
run;
/* To test macro vars*/
%macro affiliated;
%do i=1 %to &total_obs;
%put firm_i=&&firm_&i;
%put mindat=&&mindat_&i;
%put maxdat=&&maxdat_&i;
%end;
%mend;
%affiliated;
/* END*/
So you are saying in R I can use the functions that you mention to subtract
the info from dataframe containing all the values & pass it on? I am using
the sqldf package.
I am using sqldf package.
--
View this message in context: http://r.789695.n4.nabble.com/Paasing-values-to-sqlQuery-like-SAS-macro-tp4643033p4643078.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list