Cancel

Reply
Contributor
Posts: 46

Cancel

[ Edited ]
 
SAS Super FREQ
Posts: 8,868

Re: Sales report using Proc report

Posted in reply to Malathi13
Hi, I think that what you want is similar to what is shown in this posting
https://communities.sas.com/t5/Base-SAS-Programming/Proc-report-help/m-p/327149#M72959

But, since you posted your code, without data, there is no way to test your code without making up date. And, since your desired report has Manufacturing and Derm, vision and ears, while your bottom picture shows Transform and Target and Derm and Vision, it is hard to figure out what is going on.

To me, it appears that you are getting what you coded. The default behavior for PROC REPORT is to give you one column for every group or order item in your COLUMN statement and for ACROSS items like quarter, you get one column for every unique value of the quarter value.

Also your use of some LISTING only options, in conjunction with the fact that you didn't show any ODS statements or any data, leaves me in doubt that you have read any of the documentation on PROC REPORT and ODS. What destination are you using for this report? Do you really want LISTING only output? Your HEADLINE, HEADSKIP, OL and UL options will be ignored by other ODS destinations like RTF, PDF, HTML and EXCEL.

Can you post ALL your code, including your ODS statements and some sample data? Otherwise, it is hard to make any constructive suggestions.

cynthia
Contributor
Posts: 46

Cancel

[ Edited ]
Posted in reply to Cynthia_sas
 
SAS Super FREQ
Posts: 8,868

Re: Sales report using Proc report

Posted in reply to Malathi13
Hi:
You should be able to right click on the image and select View Image to see a bigger picture of the code and the output.

I am teaching today and unable to make fake data to run with your program. Seeing your whole program without data is something of an improvement, but not much of one. The heart of my program is nearly the same as the example for inserting a section header in Jane Eslinger's paper https://support.sas.com/resources/papers/proceedings15/SAS1642-2015.pdf starting on page 11. However, I suggest you read the whole paper for a good understanding of the COMPUTE block.

cynthia
Contributor
Posts: 46

Re: Sales report using Proc report

Posted in reply to Cynthia_sas

Hi Cynthia,

Thank you so much for th ehelp. It worked with that SASHELP.SHOES proc report code. Except that the prod_grp is left justified and I wanted it in the center. I'll figure it out, but thanks again.

 

Malathi

SAS Super FREQ
Posts: 8,868

Re: Sales report using Proc report

Posted in reply to Malathi13
Hi, in my code, it is justified because of this:
compute before region / style={just=l fontweight=bold};

you only need to change just=l to just=c.

cynthia
Contributor
Posts: 46

Re: Sales report using Proc report

Posted in reply to Cynthia_sas
Hi Cynthia,
One more thing I want to do is to add comma for the Quarter. The quarter has 2015q1, 2015q2, 2015q3 and 2015q4 and the obs are the sales amount for each quarter. I want to add comma to these sales amount, do I have to add comma10. to quarter variable? I'm getting "ERROR: quarter must use a character format". I tried adding that to prod_grp and I get the same error. In proc report, do I have to add f=comma10. to which variable?

Any help???
Thanks
Malathi
SAS Super FREQ
Posts: 8,868

Re: Sales report using Proc report

Posted in reply to Malathi13
Hi:
How are you creating the quarter variable? Is it character? If so, you cannot use a numeric format with a character variable. Since you never posted your data, it is impossible to answer this question. Based on the code you submitted, it appeared to me that QUARTER was a character variable. And the usage for that character variable is the ACROSS usage. Somehow, you are getting numbers in the cells under QUARTER and for this to happen, I would expect to see a different column statement. Are you sure that the code you have posted is the EXACT code you're using. I would expect your COLUMN statement to be different... more like:

columns prod_cat prod_grp quarter,numvar net_sell_price;

which would tell SAS that the "NUMVAR" numeric variable should be "stacked" under every unique value for QUARTER. But that's not what your COLUMN statement shows. So I'm not sure what to recommend. If you have QUARTER,NUMVAR or QUARTER,NET_SALES_PRICE, then the COMMA format would go on the numeric variable.

cynthia
Ask a Question
Discussion stats
  • 7 replies
  • 214 views
  • 0 likes
  • 2 in conversation