Hi Reeza, Thanks for your reply... 1) I created a data source prompt, but what I get in the SAS code is the metadata path. For example: DATASOURCE_1=/Shared Data/CLASS(Table) DATASOURCE_1_TYPE=1 Um, I'm gonna need sashelp.class somewhere in my code. /Shared Data/CLASS(Table) is less than helpful. 2) I created a data source item prompt, multiple ordered values, allow users to select from multiple data sources. The user interface looks pretty promising. However, what I get in the SAS log is: DATASOURCEITEM_5=Name DATASOURCEITEM_50=5 DATASOURCEITEM_51=Name DATASOURCEITEM_52=Sex DATASOURCEITEM_53=Region DATASOURCEITEM_54=Product DATASOURCEITEM_55=Subsidiary DATASOURCEITEM_5_COUNT=5 DATASOURCEITEM_5_PATH=/Shared Data/CLASS DATASOURCEITEM_5_PATH1=/Shared Data/CLASS DATASOURCEITEM_5_PATH2=/Shared Data/CLASS DATASOURCEITEM_5_PATH3=/Shared Data/SHOES DATASOURCEITEM_5_PATH4=/Shared Data/SHOES DATASOURCEITEM_5_PATH5=/Shared Data/SHOES DATASOURCEITEM_5_SOURCE_TYPE=1 DATASOURCEITEM_5_SOURCE_TYPE1=1 DATASOURCEITEM_5_SOURCE_TYPE2=1 DATASOURCEITEM_5_SOURCE_TYPE3=1 DATASOURCEITEM_5_SOURCE_TYPE4=1 DATASOURCEITEM_5_SOURCE_TYPE5=1 DATASOURCEITEM_5_TYPE=1 DATASOURCEITEM_5_TYPE1=1 DATASOURCEITEM_5_TYPE2=1 DATASOURCEITEM_5_TYPE3=1 DATASOURCEITEM_5_TYPE4=1 DATASOURCEITEM_5_TYPE5=1 Um, what I NEED is something like: DATASOURCEITEM_51=SASHELP.CLASS.Name DATASOURCEITEM_52=SASHELP.CLASS.Sex DATASOURCEITEM_53=SASHELP.SHOES.Region DATASOURCEITEM_54=SASHELP.SHOES.Product DATASOURCEITEM_55=SASHELP.SHOES.Subsidiary or something like that. And isn't this rather like database column syntax that's been around forever? It's not like SAS even needed to reinvent a new syntax. THIS I could parse in macro code! For the end programmer trying to actually DO something with the results (macro variables) of the prompting mangler, /Shared Data/CLASS is pretty useless. Whoever dreamed up this syntax wasn't a SAS programmer, but I would have thought SAS would have done some usability testing before releasing this (prompting mangler) on their users. If someone is aware of a way to translate a macro variable containing the metadata path to a table definition, to the libref and memname of the table that it references, please let me know. A pointer to the doc example would be fantastic. So, for now I've defined in metadata tables from the SASHELP dictionary views, i.e. VSLIB, VSTABLE, VTABLE, VCOLUMN, etc, and bound them to dynamic list text prompts. VSTABLE depends on VSLIB. VCOLUMN depends on VSLIB and VSTABLE, etc. 3) I'm not sure how to make it clearer??? I want the same or similar functionality available to the end user of a stored process as that available in EG or AMO Filter & Sort task, Filter tab, i.e. a point and click, easy to use way to generate a dynamic, syntactically correct where clause based on the source dataset. 4) I'm happy to hard code the joins in the stored process. It's the where clause against the fact table that I want to be dynamic and flexible. I'll probably use a hash object join to link in dimension data rather than SQL anyway, which is easier syntax to generate in the stored process. Finally, I have come up with something "interesting", but not sure if I'll use it or not. Performance is a major consideration, especially with a large number of rows, as well as the overall user experience. I'll describe it here. If you have AMO, you may want to play along... In Excel, use the SAS Data task to drop a table on Sheet1. I used SASHELP.PRDSALE. Use the built-in Filter and Sort menu to drop columns, change their order, add a where clause, and sort the results. Click OK and view the results. Note: This will create the Named Range Table1. I've created a stored process "Create Dataset from Excel Table". It has 5 text prompts: InLib, InData, OutLib, OutData, and Return (return the dataset to Excel? No=0, Yes=1) InLib and InData MUST match the table selected for Sheet1, i.e. SASHELP.PRDSALE. This is needed to create the correct variable attributes of the uploaded dataset. (Hmmm...I may be able to get the dataset name from the DataView object name (SASApp:SASHELP.PRDSALE) and use VBA to set the parameter of the stored process (so perhaps make it a hidden parameter). This would be an improved user experience.) The stored process has an input stream defined as xl_data, text/xml, rewind. Drop this stored process on Sheet2. When you initially drop the stored process, it will ask for the input stream. Enter =Table1[#ALL]. Here is the code for the stored process: %macro CreateDatasetFromExcelTable; libname xl_data xmlv2; * get variables from instream dataset ; proc contents data=xl_data.&_webin_sasname out=work.contents (keep=name varnum) noprint; run; proc sql noprint; select name into :vars separated by " " from work.contents order by varnum ; quit; data &outlib..&outdata; format &vars; %* set PDV order based on Excel table ; if 0 then set &inlib..&indata (keep=&vars); %* set variable attrs based on source table ; set xl_data.&_webin_sasname; %* set data values based on Excel table ; run; %if (&return) %then %do; %* all of this is for debugging ; proc print noobs; run; proc contents data=&syslast; run; %end; %mend; options mprint nocenter; %CreateDatasetFromExcelTable This does an OK job of replicating the dataset that was filtered on the server by the SAS Data task and returned to Excel. I could then "chain" a 2nd stored process to work with that "uploaded" dataset and join in additional data, summarize data, etc. But again, if I could generate a decent where clause from the stored process prompting mangler I would skip the SAS Data process altogether. Performance is a concern since 1) the query returns the result set to Excel (probably via XML under the covers, which gets parsed by the AMO addin, and 2) I turn right around and pass the result set back as XML for the stored process to create the same dataset on the server. If there was a way I could "trick" the SAS Data process to 1) create the result set as a dataset on the server, and 2) not download the result set back to Excel, I'd do that. But, #2 defeats the purpose of the SAS Data functionality, so I can see why that's not baked into the product. Thoughts?
... View more