The SAS Output Delivery System and reporting techniques

Proc Report

Occasional Contributor
Posts: 7

Proc Report

Hi, I am going to generate one report using proc report and report will run once in a week and generate one more additional column . I want to automise this code using %do Loop or something else but don't know how to do it?

Please find the attach code. It is just 1/10 size of the original proc report code.

Super User
Super User
Posts: 9,416

Re: Proc Report

Posted in reply to Minaxi_Patel

And what happens when there is not enough width on the page to fit all your columns in?  My suggestion would be not to do it this way.  What you are talking about is normalized data, i.e. fixed number of columns with the data going down the page.  So set your data up such:

flg     stat     commercial     period               value

X      XXX    XXXX              05JAN14          XXX

X      XXX    XXXX              12JAN14          XXX

And then you have the abilty to list any amount of data down the page, fix your proc report so no updating each time.  That would be my suggestion.  If you don't want to follow it then you open a whole world of pain for yourself.  The actual code generation part is pretty straight-forward:

data _null_;

     set sashelp.vcolumn (where=(libname="XYZ" and memname="DSNAME") in=a)

           sashelp.vcolumn (where=(libname="XYZ" and memname="DSNAME") in=b) end=last /* one for column statement, one for define */;

     if _n_=1 then call execute('proc report data=... options...; column ');

     if a then call execute(' '||name);

     else call execute(' define '||name||' / display noprint;');

     if last then call execute(' compute statements; run;');


However your main problem is going to be layout, data which doesn't conform to what you expect, page breaking in unusual places etc.

Occasional Contributor
Posts: 7

Re: Proc Report

I can't change my report format as per your suggetion.Smiley Sad

Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation