title: What is the function of an ID statement in Proc means in SAS?
body: <p>I am working on replicating a SAS code into a R code and I came across the following SAS code snippet -</p>
  
  <pre><code>proc means data=A noprint;
  by name date; 
  id comp_no;
  var price; 
  id rep_dats act no;
  output out= test(drop=_type_ _freq_)        
  median=median n=num; 
  run;
  </code></pre>
  
  <p>I know that the 'by' statement is used to group by to give statistics at that level. But, what is 'id' used for? Why are there two 'id' statements? I checked out SAS help but I didn't really understand it. I also checked out their examples at <a href="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p19dfq16fqt1t3n1eroiabnn6r3s.htm" rel="nofollow">http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p19dfq16fqt1t3n1eroiabnn6r3s.htm</a>.
  But there was no example illustrating the use of ID. </p>
  
  <p>As I don't have access to SAS, I can't try this out and see how the output looks like. 
  Any clarifications would be of great help to me. Thanks!</p>