title: R Version of SAS macro variable?
body: <p>I am pretty familiar with SAS. I am a beginner in R and am trying to figure out what the R equivalent of macro variables is. Specifically I have 6 datasets with a common variable name, Price. I want to create a loop that changes Price in each data set to DatasetNamePrice. This would be simple in SAS using macro variables for text replacement. So far I have created vector with the names of each data set.</p>
  
  <pre><code>v=c("SP","SPF","SPP","NQ","RTY","NYA")
  </code></pre>
  
  <p>I usually use this code to rename variables:</p>
  
  <pre><code>names(SP)[names(SP)=="Price"]="SPPrice"
  </code></pre>
  
  <p>My attempt so far is:</p>
  
  <pre><code>for(i in 1:6) 
  { 
    names(v[[i]])[names(v[[i]])=="Price"]="v[[i]]Price"
  }
  </code></pre>
  
  <p>R does not give me any errors when this runs but does not appear to do anything. Any help is appreciated.</p>