The SAS Output Delivery System and reporting techniques

Proc Report Limit column value display for few rows

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

Proc Report Limit column value display for few rows

 

 

My current output using proc report is in below format :

 

Change TypeScript_Count (%)Member (%)
Neutral - No Change95.48%95.48%
Positive Change2.76%2.76%
Negative Change1.76%1.76%
Total Percentage100.00%100.00%

 

 

 

But , Client is asking for Member(%) data for only Negative Change : It should look like below 

 

Change TypeScript_Counts (%)Member (%)
Neutral - No Change95.48%-
Positive Change2.76%-
Negative Change1.76%1.76%
Total Percentage100.00%-

 

any idea how can i limit the column value only for  one row. ?

 

My Current code and data below.

 

 

DATA SET :  

 

SASUSER.chg_pct

 

Change_DescScript_countmbr_pct
195.48%95.48%
22.76%2.76%
31.76%1.76%

 

 

CODE:

 

proc format;
value $Change_Sum
'1'='Neutral - No Change'
'2'='Positive Change'
'3'='Negative Change'
'T'='Total Percentage';
run;

 

 

proc report data=SASUSER.chg_pct nowd;
column Change_Desc Script_Percent mbr_pct;
TITLE J=L "Summary";
DEFINE Change_Desc / GROUP ' Change Type' FORMAT=$Change_Sum. CENTER width=22 order=INTERNAL MISSING;
define Script_Percent / analysis SUM ' Script_Counts (%)' format=PERCENT8.2 CENTER missing;
define mbr_pct / analysis SUM 'Member (%)' format=PERCENT8.2 CENTER missing ;
RBREAK AFTER / summarize ;
COMPUTE AFTER ;
Change_Desc= 'T';
endcomp;
RUN;
TITLE;

 

Any help would be highly appreciated.

 

 

Thanks,

M

 


Accepted Solutions
Solution
‎07-25-2016 10:26 AM
SAS Super FREQ
Posts: 8,721

Re: Proc Report Limit column value display for few rows

Assuming that Change_desc is character and that you fix the issue with script_count vs script_percent on the report, something like this should work to change mbr_pct:

compute mbr_pct;
if change_desc ne '3' then
mbr_pct.sum = .;
endcomp;

Then to have it show as a -, you would need:
options missing = '-';
before the PROC REPORT step.
cynthia

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,721

Re: Proc Report Limit column value display for few rows

Where does the variable SCRIPT_PERCENT come from? You show variable SCRIPT_COUNT in your view of the data, but you do not use SCRIPT_COUNT in your program. An error is generated using your code because the dataset chg_pct does not have SCRIPT_PERCENT:
ERROR: Variable Script_Percent is not on file xxx.CHG_PCT.

And is CHANGE_DESC numeric or character? You have a character format, but do not provide any instructions for how to read the data.

cynthia
Solution
‎07-25-2016 10:26 AM
SAS Super FREQ
Posts: 8,721

Re: Proc Report Limit column value display for few rows

Assuming that Change_desc is character and that you fix the issue with script_count vs script_percent on the report, something like this should work to change mbr_pct:

compute mbr_pct;
if change_desc ne '3' then
mbr_pct.sum = .;
endcomp;

Then to have it show as a -, you would need:
options missing = '-';
before the PROC REPORT step.
cynthia
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 219 views
  • 1 like
  • 2 in conversation