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.
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;');
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.
I can't change my report format as per your suggetion.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.