<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Dataset list in data step view does not work as expected in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11826#M1189</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all the replies, much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, they all addressed *how* SAS works with respect to data step views, which I had already deduced.&amp;nbsp; I was more interested in people's opinions of *how* they thought SAS should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I must admit I don't recall ever creating a data step view using a variable list but, as Howles said, the variable list in the data step view is static as defined at compile time.&amp;nbsp; And the same behaviour holds for data set lists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know the data step view is a compiled object where the definition is compiled, but the data is dynamic and derived at run time.&amp;nbsp; I guess the question is, should variable lists and data set lists in a data step view be dynamic as well?&amp;nbsp; After all, it's just software; SAS could have created this to work in either way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IMO, dynamic variable lists and data set lists would be very useful, but I admit it could also cause confusion / problems if the data set structure changed after the view was created.&amp;nbsp; But, if I had to choose, I would make the variable lists and data set lists dynamic, where the data step view derives the list at runtime.&amp;nbsp; I suspect the current functionality was just "easier" when data step views were first developed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case, I find the "describe view" functionality to be misleading; I believe it should return the expanded lists as they were defined at compile time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the various replies, I could either just redefine the view each time, rather than defining a permanent view, or use the dictionary tables.&amp;nbsp; As suggested, I did choose to use the dictionary tables, as I found the generated code to be clearer.&amp;nbsp; But the results are the same in both approaches.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Dec 2011 13:04:39 GMT</pubDate>
    <dc:creator>ScottBass</dc:creator>
    <dc:date>2011-12-20T13:04:39Z</dc:date>
    <item>
      <title>Dataset list in data step view does not work as expected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11821#M1184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS 9.2 on Windows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to ensure a dataset for a marketing mailout does not inadvertently contain customers already submitted previously.&amp;nbsp; To accomplish this, I delete any customer numbers from today's mailout that are contained in any previous mailout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To accomplish this, I was hoping to use a permanent data step view to concatenate all the previous mailouts, then use PROC SORT NODUPKEY on the concatenated view, then delete those records contained in the PROC SORT output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I'm not getting the desired outcome.&amp;nbsp; It appears that the dataset list is NOT dynamic, but in fact is compiled into the view at compile time.&amp;nbsp; IMO this behaviour is a bug.&amp;nbsp; Does anyone else agree before I raise a support track?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;data d_1 d_2 d_3;
&amp;nbsp; x=1;
run;

data all/view=all;
&amp;nbsp; length dsname $32;
&amp;nbsp; set d_: indsname=dsn;
&amp;nbsp; dsname=scan(dsn,2);
run;

proc print data=all;
run;

data d_4;
&amp;nbsp; x=1;
run;

proc print data=all;
run;

proc delete data=d_2;
run;

proc print data=all;
run;
&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The view does not print the d_4 data, and it fails if d_2 is deleted.&amp;nbsp; If I select "describe view" in SAS Explorer, it indicates the set statement contains a dataset list, which I would have expected would be evaluated at run time, not compile time.&amp;nbsp; If nothing else, it's very misleading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Dec 2011 01:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11821#M1184</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2011-12-10T01:59:16Z</dc:date>
    </item>
    <item>
      <title>Dataset list in data step view does not work as expected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11822#M1185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have little experience with dataset lists, which are a pretty new feature.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, variable lists, an old feature, are evaluated at compile time, so I think I would expect the behavior you found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would use PROC SQL and tap DICTIONARY.TABLES to get the current list.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Dec 2011 03:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11822#M1185</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2011-12-10T03:29:53Z</dc:date>
    </item>
    <item>
      <title>Dataset list in data step view does not work as expected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11823#M1186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not familiar with dataset lists either but, from your explanation, I wonder if you are deleting the correct records.&amp;nbsp; I would think that you would want to delete any 'customer numbers' who end up in a dupout file created by a proc sort nodupkey run.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Dec 2011 14:48:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11823#M1186</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-12-10T14:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dataset list in data step view does not work as expected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11824#M1187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott -&amp;nbsp; I am seeing the same behavior as you are. You will need to generate the list of datasets in another way.&amp;nbsp; Such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;proc sql noprint ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select memname into :mlist separated by ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.tables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname='WORK'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and substr(memname,1,2) = 'D_'&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data all;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set &amp;amp;mlist indsname=dsn ; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Dec 2011 16:58:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11824#M1187</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-12-10T16:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dataset list in data step view does not work as expected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11825#M1188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VIEW only contains the information of QUERY ,it is static.&lt;/P&gt;&lt;P&gt;If you want it more robust, then use Tom's code to collect the existed datasets firstly, or use macro to detect it existence firstly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %sysfunc(exist(class)) %then %do;&amp;nbsp;&amp;nbsp; class %end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %else %if %sysfunc(exist(shoes)) %then %do;&amp;nbsp;&amp;nbsp; shoes%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2011 03:57:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11825#M1188</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-12-12T03:57:47Z</dc:date>
    </item>
    <item>
      <title>Dataset list in data step view does not work as expected</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11826#M1189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all the replies, much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, they all addressed *how* SAS works with respect to data step views, which I had already deduced.&amp;nbsp; I was more interested in people's opinions of *how* they thought SAS should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I must admit I don't recall ever creating a data step view using a variable list but, as Howles said, the variable list in the data step view is static as defined at compile time.&amp;nbsp; And the same behaviour holds for data set lists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know the data step view is a compiled object where the definition is compiled, but the data is dynamic and derived at run time.&amp;nbsp; I guess the question is, should variable lists and data set lists in a data step view be dynamic as well?&amp;nbsp; After all, it's just software; SAS could have created this to work in either way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IMO, dynamic variable lists and data set lists would be very useful, but I admit it could also cause confusion / problems if the data set structure changed after the view was created.&amp;nbsp; But, if I had to choose, I would make the variable lists and data set lists dynamic, where the data step view derives the list at runtime.&amp;nbsp; I suspect the current functionality was just "easier" when data step views were first developed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case, I find the "describe view" functionality to be misleading; I believe it should return the expanded lists as they were defined at compile time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the various replies, I could either just redefine the view each time, rather than defining a permanent view, or use the dictionary tables.&amp;nbsp; As suggested, I did choose to use the dictionary tables, as I found the generated code to be clearer.&amp;nbsp; But the results are the same in both approaches.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 13:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dataset-list-in-data-step-view-does-not-work-as-expected/m-p/11826#M1189</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2011-12-20T13:04:39Z</dc:date>
    </item>
  </channel>
</rss>

