The SAS Output Delivery System and reporting techniques

using Proc Report

Reply
Occasional Contributor
Posts: 10

using Proc Report

Hi, 

 

I am trying to summarize the data (sample data attached) in the attached sample template with proc report. However I am getting error message  after I write this code 

 

proc report data=sample

out=lat nowd;

column FT TERM_DESC work  let2015 ;

define FT/group;

define TERM_DESC/ ACROSS ;

compute let2015;

if TERM_DESC = "Fall 2016" THEN let2015 = work.sum ;

endcomp;

quit;

 

 

The error message states - Variable TERM_DESC is uninitialized.

 

Will appreciate some guidance in moving ahead and any tips to overcome any future hurdles in the report.  

 

Thanking you!

 

Super User
Super User
Posts: 9,840

Re: using Proc Report

Per the topic here:

https://communities.sas.com/t5/Base-SAS-Programming/template/m-p/486193/highlight/false#M126458

 

Use a datastep and transposes before proc report to manipulate your data, then use a simple proc report to output the data.  This is far simpler and more effective method than using a reporting procedure to manipulate data.

Occasional Contributor
Posts: 10

Re: using Proc Report

Should I summarize the data in the Data step and then TRANSPOSE. BY doing something like this -

Data Sad;
Set UNIVERSI.univ2016_17;
if TERM_DESC= "Fall 2016" then NEWVAR = SUM(work);
else if TERM_DESC="Fall 2017" then NVAR = SUM(work);
Run;
Super User
Super User
Posts: 9,840

Re: using Proc Report

Without seeing your data I have no idea.  You are effectively doing that in the proc report though, so just a matter of doing it in a datastep.  sum() function does not work the way you think, it works horizontally, so sum(work) will be the same as work, same number of observations.  You would need to retain it across rows:

data sad;
  set...;
  retain newvar nvar;
  if...;
run;
Occasional Contributor
Posts: 10

Re: using Proc Report

Thank you for your reply. I have attached the Dataset and the reporting template here. Can you please advice the most efficient way to go about this.    

Ask a Question
Discussion stats
  • 4 replies
  • 84 views
  • 0 likes
  • 2 in conversation