I have 6 tables that contains different information (price, region, sales, manger, etc) for all inventory items. I need to create excel spreadsheet for each inventory item. This excel spreadsheet would have 6 separate tabs to show each item's info from the corresponding tables. Below is what I am doing (also see codes below) Assign XLSX libname to create an excel file for each Inventory item Use Macro A and B to create spreadsheet with 6 separate tabs for inventory item z3597 and J64x9, respectively My question is since I have around 25 inventory items (and this number may go up or down each weekly), I would need to assign 25 XLSX libname and run the same macro for 25 times for each inventory number. What is a more efficient way or better way to accomplish this task? Thanks for everyone's advices. LIBNAME A XLSX '/sharedspace/inventory/users/sammy/file_one.XLSX'; LIBNAME B XLSX '/sharedspace/inventory/users/sammy/file_two.XLSX'; LIBNAME Inv '/sharedspace/inventory/weekly/Inv'; %MACRO A(SHEET_NAME, TABLE); DATA A.&SHEET_NAME; SET Inv.&TABLE (WHERE=(Inventory_num EQ "Z35q7")); RUN; %MEND; %A(INVENTORY_PRICE,INVENTORY_PRICE); %A(INVENTORY_REGION,INVENTORY_REGION); %A(INVENTORY_SALES,INVENTORY_SALES); %A(INVENTORY_MANAGER,INVENTORY_MANAGER); %A (INVENTORY_PRODUCT, INVENTORY_PRODUCT); %A (INVENTORY_TYPE,INVENTORY_TYPE ); %MACRO B(SHEET_NAME, TABLE); DATA B.&SHEET_NAME; SET Inv.&TABLE (WHERE=(Inventory_num EQ "J64x9")); RUN; %MEND; %B(INVENTORY_PRICE,INVENTORY_PRICE); %B(INVENTORY_REGION,INVENTORY_REGION); %B(INVENTORY_SALES,INVENTORY_SALES); %B(INVENTORY_MANAGER,INVENTORY_MANAGER); %B (INVENTORY_PRODUCT, INVENTORY_PRODUCT); %B (INVENTORY_TYPE,INVENTORY_TYPE );
... View more