Skip to content
Back to formatted view

Raw Message

Message-ID: <1347571104129-4643078.post@n4.nabble.com>
Date: 2012-09-13T21:18:24Z
From: ramoss
Subject: Paasing values to sqlQuery like SAS macro
In-Reply-To: <CAJ55+dLkPFkOiNf99pQWxKNLLZycz561G8U32eKUK7DWcMg=0w@mail.gmail.com>

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.