<?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 Re: data step view in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/data-step-view/m-p/97334#M787</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;The answer is 'D'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without you asking and me doing some testing I would have got it wrong and answered 'B'. You wouldn't define anything else than "data table /view=table;" in a real life scenario and until now I wasn't aware that anything else is even possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Think of a view as pre-compiled code which gets executed in the moment when you use it (so for example in a SET statement).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I never realised so far is that this also means for a data step view that you can have more than one output table. I always thought that a data step view is kept in memory and kind-of "streamed" into the data step where its used. But clearly using the code you've posted when actually executing the view using a SET statement table work.condo gets created as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure there will be some special case where such behaviour comes in handy - but it will need a LOT of in-program comment because such behaviour is rather exotic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here some code showing what's going on:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets lib=work kill nowarn nolist;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data condo_ranch;&lt;BR /&gt;&amp;nbsp; infile datalines dsd;&lt;BR /&gt;&amp;nbsp; input style $ sqfeet saledate : date9.;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;RANCH,1250,10MAR2004 &lt;BR /&gt;CONDO,1400,17JUN2004 &lt;BR /&gt;RANCH,1500,20JAN2004 &lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ranch condo /view=ranch;&lt;BR /&gt;&amp;nbsp; set condo_ranch;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if style='CONDO' then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output condo;&lt;BR /&gt;&amp;nbsp; else if style='RANCH' then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output ranch;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data view=work.ranch;&lt;BR /&gt;&amp;nbsp; describe;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title "Tables in WORK before executing the view";&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp; select memname,memtype from dictionary.tables where libname='WORK'&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; set work.ranch;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title "Tables in WORK after executing the view";&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp; select memname,memtype from dictionary.tables where libname='WORK'&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 29 Sep 2013 10:06:57 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2013-09-29T10:06:57Z</dc:date>
    <item>
      <title>data step view</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/data-step-view/m-p/97332#M785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;Can you please tell me which one of the below options is the answer &lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;for the question&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;Consider the following SAS log:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;229 data sasuser.ranch sasuser.condo / view = sasuser.ranch;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;230 set sasuser.houses;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;231 if style ='RANCH' then output sasuser.ranch;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;232 else if style = 'CONDO'then output sasuser.condo;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;233 run;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;NOTE: DATA STEP view saved on file SASUSER.RANCH&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;NOTE: A stored DATA STEP view cannot run under a different operating &lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;system.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;235 proc print data= sasuser.condo;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;ERROR: File SASUSER.CONDO.DATA does not exist.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;236 run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;Which one of the following explains why the PRINT procedure fails?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;A. SASUSER.CONDO is a stored DATA step program.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;B. A SAS data file and SAS data view cannot be created in the same &lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;DATA step.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;C. A second VIEW=SASUSER.CONDO option was omitted on the DATA &lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;statement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;D. The view SASUSER.RANCH must be processed before SASUSER.CONDO is &lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;created.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;However, when I tried similar code, as shown below, I didn't get an error message. CONDO.DATA&amp;nbsp; was created. Very confusing. Would you like to help me?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;data condo_ranch;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;infile datalines dsd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;input style $ sqfeet saledate : date9.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;datalines;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;RANCH,1250,10MAR2004 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;CONDO,1400,17JUN2004 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;RANCH,1500,20JAN2004 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;data ranch condo /view=ranch;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;set condo_ranch;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;if style='CONDO' then output condo;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; font-family: 'Courier New';"&gt;else if style='RANCH' then output ranch;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;proc print data=condo;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; line-height: 115%; font-family: 'Courier New'; font-size: 11pt; mso-fareast-language: KO; mso-bidi-language: AR-SA; mso-ansi-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 'Malgun Gothic';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Sep 2013 03:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/data-step-view/m-p/97332#M785</guid>
      <dc:creator>withus</dc:creator>
      <dc:date>2013-09-29T03:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: data step view</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/data-step-view/m-p/97333#M786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post your log, with above code submitted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Sep 2013 04:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/data-step-view/m-p/97333#M786</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-09-29T04:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: data step view</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/data-step-view/m-p/97334#M787</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;The answer is 'D'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without you asking and me doing some testing I would have got it wrong and answered 'B'. You wouldn't define anything else than "data table /view=table;" in a real life scenario and until now I wasn't aware that anything else is even possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Think of a view as pre-compiled code which gets executed in the moment when you use it (so for example in a SET statement).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I never realised so far is that this also means for a data step view that you can have more than one output table. I always thought that a data step view is kept in memory and kind-of "streamed" into the data step where its used. But clearly using the code you've posted when actually executing the view using a SET statement table work.condo gets created as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure there will be some special case where such behaviour comes in handy - but it will need a LOT of in-program comment because such behaviour is rather exotic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here some code showing what's going on:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets lib=work kill nowarn nolist;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data condo_ranch;&lt;BR /&gt;&amp;nbsp; infile datalines dsd;&lt;BR /&gt;&amp;nbsp; input style $ sqfeet saledate : date9.;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;RANCH,1250,10MAR2004 &lt;BR /&gt;CONDO,1400,17JUN2004 &lt;BR /&gt;RANCH,1500,20JAN2004 &lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ranch condo /view=ranch;&lt;BR /&gt;&amp;nbsp; set condo_ranch;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if style='CONDO' then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output condo;&lt;BR /&gt;&amp;nbsp; else if style='RANCH' then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output ranch;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data view=work.ranch;&lt;BR /&gt;&amp;nbsp; describe;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title "Tables in WORK before executing the view";&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp; select memname,memtype from dictionary.tables where libname='WORK'&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; set work.ranch;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title "Tables in WORK after executing the view";&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp; select memname,memtype from dictionary.tables where libname='WORK'&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Sep 2013 10:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/data-step-view/m-p/97334#M787</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-09-29T10:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: data step view</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/data-step-view/m-p/97335#M788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not so strange there is even an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/64801/HTML/default/viewer.htm#n07vq6hmss6f67n1vhnnn5cw0chh.htm"&gt;Example 2: Producing Additional Output Files&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Sep 2013 13:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/data-step-view/m-p/97335#M788</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-09-29T13:02:34Z</dc:date>
    </item>
  </channel>
</rss>

