data work.r_six_month (keep=ID Stage r_date);
set r_prod_t;
where r_date between "&Month_back6."d and "&last_month"d and latest_run_in_mth = 'Y';
run;
PROC SQL;
CREATE TABLE WORK.r_month_fmt AS
SELECT ID,
Stage,
r_date,
r_date FORMAT=MONNAME9. AS Month
FROM WORK.R_SIX_MONTH;
QUIT;
proc sort data=r_month_fmt;
by ID;
run;
proc transpose data=r_month_fmt out=r_trans_month(drop= _name_);
by ID;
var Stage;
id Month;
run;
PROC SQL;
CREATE TABLE WORK.r_t_format_month AS
SELECT t1.ID,
/* May_ */
(put(t1.' May'n,z1.)) AS May,
/* June_ */
(put(t1.' June'n,z1.)) AS June,
/* July_ */
(put(t1.' July'n,z1.)) AS July,
/* August_ */
(put(t1.' August'n,z1.)) AS August,
/* September_ */
(put(t1.September,z1.)) AS September,
/* October_ */
(put(t1.' October'n,z1.)) AS October
FROM WORK.r_trans_month t1;
QUIT;
Hi,
below piece of code i want to make dynamic. After transpose from above step Month is converted to numeric
i want to make a dynamic format conversion ... because every month i pull the data for last six month. I don't want
to change the program and formats manually every month.
PROC SQL;
CREATE TABLE WORK.r_t_format_month AS
SELECT t1.ID,
/* May_ */
(put(t1.' May'n,z1.)) AS May,
/* June_ */
(put(t1.' June'n,z1.)) AS June,
/* July_ */
(put(t1.' July'n,z1.)) AS July,
/* August_ */
(put(t1.' August'n,z1.)) AS August,
/* September_ */
(put(t1.September,z1.)) AS September,
/* October_ */
(put(t1.' October'n,z1.)) AS October
FROM WORK.r_trans_month t1;
QUIT;
... View more