title: Dynamically count the number of columns in a SAS table
body: <p>I need to create a footer record that displays semicolons that are equal to number of columns in the table. The table  have 47 columns but this may change so I need to dynamically count the columns without using dictionary tables. The footer record will be exported to a csv file and it's delimiter is a semicolon.</p>
  
  <p>I tried this code below, it works but when exporting the data to a csv file, the semicolons are enclosed with double quotation marks even if I used dequote function. Any idea to remove them? Thanks in advance.</p>
  
  <pre><code>proc contents data=input out=output noprint; run;
  proc sort data=output; by varnum; run; 
    data _null_; 
      set output;
      call symputx("maximum",varnum);
    run;
    data semis; 
      length ffsemis $47; 
      ffsemis = repeat(';',&amp;maximum*1);
  *   call symputx("semis",ffsemis); 
    run;
    data _null_;
      file "E:\semis.csv" delimiter=';' dsd dropover;
      set work.semis;
      if _n_=1 then do;
      put ffsemis;
    end;
    run;
  </code></pre>