BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mgorripati
Obsidian | Level 7

 

 

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ
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

2 REPLIES 2
Cynthia_sas
SAS Super FREQ
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
Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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