Hi,
Prompt variable: PMTSELECTCOLS with below multiple static list values
CALC_GLOBAL_KEY_QTY
CALC_REGION_KEY_QTY
CALC_CUSTOMER_KEY_QTY
ADJ_GLOBAL_KEY_QTY
ADJ_REGION_KEY_QTY
ADJ_CUSTOMER_KEY_QTY
SELECTED_KEY_QTY
Currently below transpose is hardcoded with all columns eventhough if we are selecting few input values from above prompt.
but we need to give dynamic variables in BY and VAR stmt based on selected input prompt values
PROC TRANSPOSE DATA=temp_report_s
OUT=temp_report_transposed
PREFIX=Column
NAME=Source
LABEL=Label
;
BY CYCLE_DT CALC_GLOBAL_KEY_QTY CALC_REGION_KEY_QTY CALC_CUSTOMER_KEY_QTY T_FORECAST_PERIOD_DT;
VAR ADJ_GLOBAL_KEY_QTY ADJ_REGION_KEY_QTY ADJ_CUSTOMER_KEY_QTY SELECTED_KEY_QTY
;
RUN;
proc print label data=report_transposed noobs width=full ;
run;
But i am not getting the expected layout with below code. Could you please help me to get the correct report layout
%macro test1;
PROC TRANSPOSE DATA=ddf_cont.temp_report_s
OUT=report_transposed
PREFIX=Column
NAME=Source
LABEL=Label
;
BY CYCLE_DT
%do i=1 %to &PMTSELECTCOLS_COUNT
%IF %SUBSTR(&&PMTSELECTCOLS&I,1,4) EQ "CALC" %THEN
&&PMTSELECTCOLS&I;
%END; T_FORECAST_PERIOD_DT;
VAR %do i=1 %to &PMTSELECTCOLS_COUNT
%IF %SUBSTR(&&PMTSELECTCOLS&I,1,4) NE "CALC" %THEN
&&PMTSELECTCOLS&I;
%END;
;
RUN;
proc print label data=report_transposed noobs width=full ;
run;
%mend;
%test1;
Hi:
This question, or a variation has been posted in these other forums:
https://communities.sas.com/message/121823#121823 (SAS Procedures forum)
https://communities.sas.com/message/121824#121824 (SAS EG Forum)
https://communities.sas.com/message/121735#121735 (Macro Forum)
https://communities.sas.com/message/121707#121707 (ODS Forum)
cynthia
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.
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.