Hi all, I have different data tables named NB_PRODUCT_GROUP1_1, NB_PRODUCT_GROUP1_2,....., NB_PRODUCT_GROUP1_24 I need to do the following for each of the above tables located in "C:...\Output_Calculation_Sets\Source" 1. select about 96 columns (TIme, Period length,...,surplus) 2. transpose the data 3. export the data into csv to the folder "C:...\Output_Calculation_Sets\results" repeat the above for all 24 tables to have 24 csv named nb_grp1_1.csv, nb_grp1_2.csv, nb_grp1_3.csv,...,nb_grp1_24.csv I'm using the following method, I've added a variable &yer to the source table so that I get a table name with a variable attached to it NB_PRODUCT_GROUP1_&yer. I then run the code below by changing %let yer= 1 to 24 (very manual and time consuming) Can someone help me to create a code which can loop the above. As bonus, instead of having 24 csv it would help to have all of them in one csv file with tabs nb_grp1_1, nb_grp1_2, nb_grp1_3,...,nb_grp1_24 Thanks in advance. Krish LIBNAME Source BASE "C:...\Output_Calculation_Sets\Source"; %let yer= 1; proc sql; create table work.nb_grp1_&yer as select Time, Period_Length, DISC_RATE, ......., MORT_ASS, Surplus FROM Source.NB_PRODUCT_GROUP1_&yer; QUIT; proc transpose DATA = work.nb_grp1_&yer name=Time let OUT = WORK.InputSetFormatted; id Time; proc export DATA = work.nb_grp1_&yer dbms=csv outfile="C:...\Output_Calculation_Sets\results\nb_grp1_&yer..csv" replace;
... View more