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');
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 */
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 */
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.