SAS Subquery in Proc Sql -
I have a table that lists libnames and their tables. I would like to create a subquery to return the minimum build number for each listed table, which is used as the libname.table libname.table in the alias
I have created the following:
proc sql; Select as CREATEDON_FRM from all tables *, select cats ("Select min (createdon)" from "strip (libname)") ". Strip" (table_name) || ")"), where freq = "DAILY" and part_date = "CREATEDON";
No errors have been generated, but created_fm values are not executed, it only creates string values such as "(pvaprov. Select min (createdon) from the institutional). "
Oblamben and table are properly resolved, but I get the statement to execute as a subquery
You can not dynamically call SQL queries from any other SQL query. Uses datesteps and execes executable to proc SQL and adds result to the base dataset.
data wants; length is milked 8; stop; run; data; data_null_ ; Set all_tables1; where freq = "daily" and part_date = "CREATEDON"; call execution (select "proc sql;" As mincreatedon as Rmit) "|| Strip (libname) || ")". Strip (table_name) || "leave; proc attached base = = data from = a; run,"); Run;
Comments
Post a Comment