title: Generating dummies in Stata
body: <p>I have a dataset in Stata of the following form</p>
  
  <pre><code>id | year 
  a  | 1950       
  b  | 1950  
  c  | 1950
  d  | 1950
  .  
  .
  .
  y  | 1950
  -----
  a  | 1951
  b  | 1951
  c  | 1951
  d  | 1951
  .
  .
  .
  y  | 1951
  -----
  ...
  </code></pre>
  
  <p>I'm looking for a quick way to rewrite the following code</p>
  
  <pre><code>gen dummya=1 if id=="a"
  gen dummyb=1 if id=="b"
  gen dummyc=1 if id=="c"
  ...
  gen dummyy=1 if id=="y"
  </code></pre>
  
  <p>and </p>
  
  <pre><code>gen dummy50=1 if year==1950
  gen dummy51=1 if year==1951
  ...
  </code></pre>