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

 

I would like to add the Title from my Proc Freq table "Monthly Automated Tracking Records" to my proc report so it is showing above the _Counts_ table when it goes out to my customer. How would I do this? 

 

proc sql; 
create table CPIM_Automation as 
SELECT DISTINCT
CPC.CHNL_PTNR_CASE_ID AS TrackingRecord
,CPT2.CHNL_PTNR_CASE_TYP_DE AS WorkType
,CPT1.CHNL_PTNR_CASE_TYP_DE AS SubType
,CPC.CHNL_PTNR_CASE_STAT_CD AS CaseStatusCode
,CPCS.SRC_SYS_CD AS SourceCode
,CPC.CHNL_PTNR_CASE_BGN_DT AS CaseStartDate
,AGET.CHNL_PTNR_CASE_SBJ_VAL_ID AS AgentType
,AGEY.CHNL_PTNR_CASE_SBJ_VAL_ID AS AgencyType
,CPCS.CHNL_PTNR_CASE_STEP_NB AS StepNumber

FROM 
CPM1P1.CHNL_PTNR_CASE_STEP CPCS
LEFT JOIN CPM1P1.CHNL_PTNR_CASE CPC ON CPCS.CHNL_PTNR_CASE_ID = CPC.CHNL_PTNR_CASE_ID
LEFT JOIN CPM1P1.CHNL_PTNR_CASE_TYP CPT1 ON CPC.CHNL_PTNR_CASE_TYP_CD = CPT1.CHNL_PTNR_CASE_TYP_CD
LEFT JOIN CPM1P1.CHNL_PTNR_CASE_TYP CPT2 ON CPT1.PRNT_CHNL_PTNR_CASE_TYP_CD = CPT2.CHNL_PTNR_CASE_TYP_CD 

       
LEFT JOIN (SELECT DISTINCT
          SUB2.CHNL_PTNR_CASE_ID, SUB2.CHNL_PTNR_CASE_SBJ_VAL_ID
          FROM CPM1P1.CHNL_PTNR_CASE_SBJ SUB2
          WHERE SUB2.CHNL_PTNR_CASE_SBJ_TYP_CD = 'CONTACTAGENTTYPE') AGET
          ON CPCS.CHNL_PTNR_CASE_ID = AGET.CHNL_PTNR_CASE_ID 

LEFT JOIN (SELECT DISTINCT
          SUB3.CHNL_PTNR_CASE_ID, SUB3.CHNL_PTNR_CASE_SBJ_VAL_ID
          FROM CPM1P1.CHNL_PTNR_CASE_SBJ SUB3
          WHERE SUB3.CHNL_PTNR_CASE_SBJ_TYP_CD = 'AGENCYTYPE') AGEY
          ON CPCS.CHNL_PTNR_CASE_ID = AGEY.CHNL_PTNR_CASE_ID
WHERE 
CaseStartDate between (intnx('month', today(), -1, 'b')+19) and (intnx('month', today(), 0, 'b')+19)
/*CaseStartDate between '20Oct2021'd and '20Nov2021'd*/
and SourceCode = 'SSPortal'
and StepNumber = 1 

ORDER BY CPC.CHNL_PTNR_CASE_ID ASC
;
quit;

proc freq data=WORK.CPIM_Automation;
	Title Monthly Automated Tracking Records;
    tables WorkType/out=_counts_ nopercent; 
run;

ods excel file="/prod/SalesOperations/appdata/users/&sysuserid./CPIM_Automation.xlsx" options (autofilter='all' sheet_name="Automation");

ods excel options(sheet_name="Summary" autofilter='all');
proc report data=_Counts_;
Define Group / display Group format=$5.
style(Column)=[font_size=8pt width=.7in tagattr='type:String'];
run;
ods excel options(sheet_name="Automation_Data" autofilter='all');
proc report data=CPIM_Automation;
Define Group / display Group format=$5. 
style(Column)=[font_size=8pt width=.7in tagattr='type:String'];
run;
ods excel options(sheet_name="_Counts_" autofilter='all');
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
ods excel options(sheet_name="Summary" autofilter='all');
title 'Your Title Goes Here';
proc report data=_Counts_;
Define Group / display Group format=$5.
style(Column)=[font_size=8pt width=.7in tagattr='type:String'];
run;
title; /* This line removes the title so it won't appear afterwards; if that's not what you want then delete this line */
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26
ods excel options(sheet_name="Summary" autofilter='all');
title 'Your Title Goes Here';
proc report data=_Counts_;
Define Group / display Group format=$5.
style(Column)=[font_size=8pt width=.7in tagattr='type:String'];
run;
title; /* This line removes the title so it won't appear afterwards; if that's not what you want then delete this line */
--
Paige Miller
LMSSAS
Quartz | Level 8
Thank you!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 396 views
  • 1 like
  • 2 in conversation