This is the last episode of my fantastic saga (ahah) Now, I've got a period from 2007Q2 to 2013Q2, so 24 quarters I have 24 tables (one per quarter) with the column ID (clients) and some quantitative variables (let say quantities, people etc.) Note that the column ID is the same for the 24 tables What I'd like to do is this (see my code below) but inside a macro, knowing that the period is determined via prompts that user chooses (YearStart YearEnd QuarterStart QuarterEnd). So what I did below is clearly not good as I have to manually write the quarters etc. Besides, a prompt is also used here (variable) with which the user chooses what variable he wants to see in the final table (Rating or EAD). Thanks a lot for your help PROC SQL; CREATE TABLE CREDITR.HISTO_RATINGS2 AS SELECT t1.Client, t1.CD_COTATION AS RATING_Q3_07, t2.CD_COTATION AS RATING_Q4_07, t3.CD_COTATION AS RATING_Q1_08, t4.CD_COTATION AS RATING_Q2_08, t5.CD_COTATION AS RATING_Q3_08, t6.CD_COTATION AS RATING_Q4_08, t7.CD_COTATION AS RATING_Q1_09, t8.CD_COTATION AS RATING_Q2_09, t9.CD_COTATION AS RATING_Q3_09, t10.CD_COTATION AS RATING_Q4_09, t11.CD_COTATION AS RATING_Q1_10, t12.CD_COTATION AS RATING_Q2_10, t13.CD_COTATION AS RATING_Q3_10, t14.CD_COTATION AS RATING_Q4_10, t15.CD_COTATION AS RATING_Q1_11, t16.CD_COTATION AS RATING_Q2_11, t17.CD_COTATION AS RATING_Q3_11, t18.CD_COTATION AS RATING_Q4_11, t19.CD_COTATION AS RATING_Q1_12, t20.CD_COTATION AS RATING_Q2_12, t21.CD_COTATION AS RATING_Q3_12, t22.CD_COTATION AS RATING_Q4_12, t23.CD_COTATION AS RATING_Q1_13, t24.CD_COTATION AS RATING_Q2_13, t1.EAD AS EAD_Q3_07, t2.EAD AS EAD_Q4_07, t3.EAD AS EAD_Q1_08, t4.EAD AS EAD_Q2_08, t5.EAD AS EAD_Q3_08, t6.EAD AS EAD_Q4_08, t7.EAD AS EAD_Q1_09, t8.EAD AS EAD_Q2_09, t9.EAD AS EAD_Q3_09, t10.EAD AS EAD_Q4_09, t11.EAD AS EAD_Q1_10, t12.EAD AS EAD_Q2_10, t13.EAD AS EAD_Q3_10, t14.EAD AS EAD_Q4_10, t15.EAD AS EAD_Q1_11, t16.EAD AS EAD_Q2_11, t17.EAD AS EAD_Q3_11, t18.EAD AS EAD_Q4_11, t19.EAD AS EAD_Q1_12, t20.EAD AS EAD_Q2_12, t21.EAD AS EAD_Q3_12, t22.EAD AS EAD_Q4_12, t23.EAD AS EAD_Q1_13, t24.EAD AS EAD_Q2_13 FROM CREDITR.RATINGS1 t1, CREDITR.RATINGS2 t2, CREDITR.RATINGS3 t3, CREDITR.RATINGS4 t4, CREDITR.RATINGS5 t5, CREDITR.RATINGS6 t6, CREDITR.RATINGS7 t7, CREDITR.RATINGS8 t8, CREDITR.RATINGS9 t9, CREDITR.RATINGS10 t10, CREDITR.RATINGS11 t11, CREDITR.RATINGS12 t12, CREDITR.RATINGS13 t13, CREDITR.RATINGS14 t14, CREDITR.RATINGS15 t15, CREDITR.RATINGS16 t16, CREDITR.RATINGS17 t17, CREDITR.RATINGS18 t18, CREDITR.RATINGS19 t19, CREDITR.RATINGS20 t20, CREDITR.RATINGS21 t21, CREDITR.RATINGS22 t22, CREDITR.RATINGS23 t23, CREDITR.RATINGS24 t24 WHERE (t1.Client = t2.Client AND t1.Client = t3.Client AND t1.Client = t4.Client AND t1.Client = t5.Client AND t1.Client = t6.Client AND t1.Client = t7.Client AND t1.Client = t8.Client AND t1.Client = t9.Client AND t1.Client = t10.Client AND t1.Client = t11.Client AND t1.Client = t12.Client AND t1.Client = t13.Client AND t1.Client = t14.Client AND t1.Client = t15.Client AND t1.Client = t16.Client AND t1.Client = t17.Client AND t1.Client = t18.Client AND t1.Client = t19.Client AND t1.Client = t20.Client AND t1.Client = t21.Client AND t1.Client = t22.Client AND t1.Client = t23.Client AND t1.Client = t24.Client); QUIT; DATA CREDITR.HISTO_RATINGS2 ; SET CREDITR.HISTO_RATINGS2 (keep=&variable:); run;
... View more