<?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: how come we proc sort with a view? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728047#M226542</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;From my standpoint, in the first block of the dataset, &lt;STRONG&gt;view&lt;/STRONG&gt; is an instruction created by reading the dataset &lt;STRONG&gt;wide &lt;/STRONG&gt;...&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'd rather say: The DATA step in this example creates a set of instructions (stored in a file temp.sas7bvew) which can be used later to read the observations of &lt;EM&gt;a&lt;/EM&gt; dataset named WIDE, restricted to three variables --&amp;nbsp;&lt;FONT face="courier new,courier"&gt;just&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;three&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;vars&lt;/FONT&gt;&amp;nbsp;-- of the types (i.e., numeric or character) found in dataset WIDE at the time when the view is created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;And in the second block of code, SAS will sort the instruction &lt;STRONG&gt;temp&lt;/STRONG&gt; then output to another dataset narrow.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not the instructions will be sorted. Normally, the SORT procedure operates on an existing physical dataset specified in the DATA= option of the PROC SORT statement (or the default dataset _LAST_). Here, however, the observations to be sorted (constituting the "dataset" I referred to in the sentence you quoted) must first be created, as they don't exist yet. This creation is accomplished by executing the instructions stored in the view, using the dataset WIDE that exists at the time when PROC SORT executes (which might be a different dataset than the WIDE dataset mentioned above, but in the example it's the same). So, the PROC SORT step will take longer than it normally would because the dataset to be sorted isn't ready yet. But this "non-existence" can obviously save a lot of disk space because the .sas7bvew file is small regardless of the size of dataset WIDE. PROC SORT processes the (partial) observations obtained from dataset WIDE via the view in the same way as it would process similar observations read from an existing physical dataset.&lt;/P&gt;</description>
    <pubDate>Sun, 21 Mar 2021 23:30:14 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-03-21T23:30:14Z</dc:date>
    <item>
      <title>how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/727990#M226508</link>
      <description>&lt;P&gt;Hi all SAS Users,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Today, when reading a suggestion from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; about &lt;STRONG&gt;TAGSORT&lt;/STRONG&gt; in dealing with large dataset, I touched a &lt;A href="https://www.lexjansen.com/nesug/nesug01/at/at1015.pdf" target="_self"&gt;document&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;When reading this document, there is one point quite strange to me&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_0-1616319392058.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56198iB9867326D28D0A1E/image-size/large?v=v2&amp;amp;px=999" role="button" title="My97_0-1616319392058.png" alt="My97_0-1616319392058.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It is quite strange to me because the&lt;STRONG&gt; view&lt;/STRONG&gt; is just an input or an instruction, not a dataset, how come we sort it afterward.&lt;/P&gt;
&lt;P&gt;My understanding is "We can not sort a VIEW".&lt;/P&gt;
&lt;P&gt;Could you please explain it to me?&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 09:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/727990#M226508</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-21T09:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/727992#M226510</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It is quite strange to me because the&lt;STRONG&gt; view&lt;/STRONG&gt; is just an input or an instruction, not a dataset, how come we sort it afterward.&lt;/P&gt;
&lt;P&gt;My understanding is "We can not sort a VIEW".&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's not the view itself that is sorted, but the dataset created by executing the instructions stored in the view. See the two blocks of notes in the log from the PROC SORT step: The first refers to the view (TEMP) and the second to the dataset (WIDE) used by the view.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the example it is mandatory to use the OUT= option of the PROC SORT statement with a different dataset name because the resulting dataset must not have the same name as the view if it is to be stored in the same library.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 10:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/727992#M226510</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-21T10:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728038#M226535</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your explanation and insightful suggestion.&lt;/P&gt;
&lt;P&gt;I am still a little bit confused here.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;It's not the view itself that is sorted, but the dataset created by executing the instructions stored in the view&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Could you please tell me what is the dataset created by executing the instructions stored in the view? From my standpoint, in the first block of the dataset, &lt;STRONG&gt;view&lt;/STRONG&gt; is an instruction created by reading the dataset &lt;STRONG&gt;wide &lt;/STRONG&gt;(Shortly speaking, view is an instruction of wide with less variables). And in the second block of code, SAS will sort the instruction &lt;STRONG&gt;temp&lt;/STRONG&gt; then output to another dataset narrow.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I may fall into a fallacy, but from my understanding, &lt;STRONG&gt;temp&lt;/STRONG&gt; here is an instruction, and the second block of code is working on such instruction and it is unreasonable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warmest regards.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 22:21:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728038#M226535</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-21T22:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728047#M226542</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;From my standpoint, in the first block of the dataset, &lt;STRONG&gt;view&lt;/STRONG&gt; is an instruction created by reading the dataset &lt;STRONG&gt;wide &lt;/STRONG&gt;...&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'd rather say: The DATA step in this example creates a set of instructions (stored in a file temp.sas7bvew) which can be used later to read the observations of &lt;EM&gt;a&lt;/EM&gt; dataset named WIDE, restricted to three variables --&amp;nbsp;&lt;FONT face="courier new,courier"&gt;just&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;three&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;vars&lt;/FONT&gt;&amp;nbsp;-- of the types (i.e., numeric or character) found in dataset WIDE at the time when the view is created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;And in the second block of code, SAS will sort the instruction &lt;STRONG&gt;temp&lt;/STRONG&gt; then output to another dataset narrow.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not the instructions will be sorted. Normally, the SORT procedure operates on an existing physical dataset specified in the DATA= option of the PROC SORT statement (or the default dataset _LAST_). Here, however, the observations to be sorted (constituting the "dataset" I referred to in the sentence you quoted) must first be created, as they don't exist yet. This creation is accomplished by executing the instructions stored in the view, using the dataset WIDE that exists at the time when PROC SORT executes (which might be a different dataset than the WIDE dataset mentioned above, but in the example it's the same). So, the PROC SORT step will take longer than it normally would because the dataset to be sorted isn't ready yet. But this "non-existence" can obviously save a lot of disk space because the .sas7bvew file is small regardless of the size of dataset WIDE. PROC SORT processes the (partial) observations obtained from dataset WIDE via the view in the same way as it would process similar observations read from an existing physical dataset.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 23:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728047#M226542</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-21T23:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728053#M226545</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your dedicated explanation. There are two points I am curious here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. I think I can totally apply the mechanism you just say to this "wrong" code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data iii/view=iii;

	set sashelp.class (keep=Height Sex Name);
run;

proc sort data=iii tagsort;
	by Sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And the log is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;39         proc sort data=iii tagsort;
40         	by Sex;
41         run;

ERROR: Cannot sort in place.
ERROR: Unable to create WORK.III.DATA because WORK.III.VIEW already exists.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am wondering if I fell into any fallacy here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You said that&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;The DATA step in this example creates a set of instructions (stored in a file temp.sas7bvew)&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I am not sure if I get you wrongly, but when I run the code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data iii/view=iii;

set sashelp.class (keep=Height Sex Name);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then I export the view &lt;STRONG&gt;iii&lt;/STRONG&gt; (Right click =&amp;gt; Share =&amp;gt;Export), I get a file with the tail &lt;STRONG&gt;sas7bdat&lt;/STRONG&gt; rather than &lt;STRONG&gt;sas7bvew&lt;/STRONG&gt;, could you please help me about this difference?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_0-1616370863424.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56207i62250F00DB69EDC1/image-size/large?v=v2&amp;amp;px=999" role="button" title="My97_0-1616370863424.png" alt="My97_0-1616370863424.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_1-1616370907725.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56208iB9BB27C2DDD058D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="My97_1-1616370907725.png" alt="My97_1-1616370907725.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 23:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728053#M226545</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-21T23:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728060#M226550</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;A view points to data: It provides data, but does not contain data.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. The view is used as input. You need an output. proc sort cannot create a sorted view, only a data set. So your code cannot possibly work. Also note that were this possible, it would make no sense to use the same view name: the sorted view points back to the unsorted view. But the sorted view would be overwritten by the sorted view, so the sorted view would point back to itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. When you export, the &lt;STRONG&gt;data&lt;/STRONG&gt; is exported.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You seem keen to learn about views. Views have a very useful role, but have a sizeable performance overhead. Consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data T; do I=1 to 1e8; output; end; run;  * Create table          ;
data _V/view=_V; set T; run;              * Create view           ;
data _null_; set  T; run;                 * Read table: 5 seconds ;
data _null_; set _V; run;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*&amp;nbsp;Read&amp;nbsp;view:&amp;nbsp;20&amp;nbsp;seconds&amp;nbsp;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just keep that in mind: Views have their place, but views are costly to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 09:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728060#M226550</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-22T09:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728072#M226556</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I know the reason, you are right&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;, let me try to explain my idea. I try to run this code and this time it &lt;STRONG&gt;successfully&lt;/STRONG&gt; runs after adding an output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data hhh/view=hhh;

	set sashelp.class (keep=Height Sex Name);
run;

proc sort data=hhh tagsort out=jjj;/*I add the out dataset here*/
	by Sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So, I rethink about what you said. So, the proc sort will not sort on view (hhh) but it will write the sorted value from hhh on an empty dataset jjj. So, it means, it cannot sort on a view but can write down the data calculation or sorting from view to an output. I hope that I understand your explanation correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;, I am keen on learning further about SAS (not only VIEW)&amp;nbsp; because I am falling in love with it. Thank you for letting me know about the time-consuming of VIEW, it is the first time I notice about that. The more I learn about it, the more I see its beauty. And the more I discuss with all of you here, the more I grow up not only in coding but also in my characteristics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding views, I keen on learning it because it is a very nice way to deal with a large dataset. And yeah, there is no free lunch, so if it cost a little space then time-consuming makes sense. The same story happening when we do proc sort with and without TAGSORT option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warmest regards and have a good week,&lt;/P&gt;
&lt;P&gt;Phil.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 04:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728072#M226556</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-22T04:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728104#M226562</link>
      <description>&lt;P&gt;Thanks to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;for continuing the discussion during the European night hours.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;: Normally, a PROC SORT statement without an OUT= option overwrites the input dataset with the sorted dataset (having the same name). However, if a &lt;EM&gt;view&lt;/EM&gt;&amp;nbsp;(.sas7bvew file) is specified as input (in the DATA= option), creating a sorted output dataset (.sas7bdat file) with the same name in the same library would cause an ambiguity as to which of the two files -- the view or the dataset -- will be meant when that name is used in a subsequent DATA or PROC step. This is what the error message&lt;/P&gt;
&lt;PRE&gt;ERROR: Unable to create WORK.III.&lt;STRONG&gt;DATA&lt;/STRONG&gt; because WORK.III.&lt;STRONG&gt;VIEW&lt;/STRONG&gt; already exists.&lt;/PRE&gt;
&lt;P&gt;points out. Specifying a different dataset name in the OUT= option avoids this problem easily.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To better understand the huge difference between the&amp;nbsp;view and the corresponding dataset (e.g., obtained by "exporting" the view), you can open both files (using your small example involving SASHELP.CLASS) with a text editor such as Notepad. Both are binary files, so be prepared to see a lot of "gibberish." But interspersed between all those strange characters you will see several snippets of human-readable text: In the .sas7bvew file these include &lt;EM&gt;meta&lt;/EM&gt;data like variable names ("Name", "Sex", "Height") and most notably SAS code ("data iii/view=iii;", "set sashelp.class", ...), but &lt;EM&gt;NEVER&lt;/EM&gt; any data (like "Alfred", "M", "Barbara", "F"). In the .sas7bdat file, however, you will see these character data values. (The numeric values, here: from variable &lt;FONT face="courier new,courier"&gt;Height&lt;/FONT&gt;, are coded and therefore less easily recognized, but they are definitely in there.) Of course, metadata is contained in the dataset as well, but &lt;EM&gt;NO&lt;/EM&gt; SAS code (e.g., a SET statement).&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 10:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728104#M226562</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-22T10:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728257#M226592</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your dedicated explanation, now I get the point.&lt;/P&gt;
&lt;P&gt;Regarding the sas7bvew and sas7bdat, I saved them to my desktop, opening them but can't see the difference as you documented, could you please help me to have a look please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data jjj;

	set sashelp.class (keep=Height Sex Name);
run;

data hhh/view=hhh;

	set sashelp.class (keep=Height Sex Name);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_0-1616439207533.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56266i23A285D6F1FE042C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="My97_0-1616439207533.png" alt="My97_0-1616439207533.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But when I open them by Notepad, there is nothing like what you mentioned&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_1-1616439265695.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56267iDE0E3724D5B14840/image-size/large?v=v2&amp;amp;px=999" role="button" title="My97_1-1616439265695.png" alt="My97_1-1616439265695.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_2-1616439288588.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56268iCB444777CD3D2380/image-size/large?v=v2&amp;amp;px=999" role="button" title="My97_2-1616439288588.png" alt="My97_2-1616439288588.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warmest regards.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 18:55:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728257#M226592</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-22T18:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728258#M226593</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;- If your datasets are compressed then very little will be readable I expect.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728258#M226593</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-03-22T19:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728261#M226594</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your suggestion, after setting compress=no, the result seems not align with what I understand from your suggestion&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;, I am wondering if I fall into any fallacy.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mmm (COMPRESS=NO);

	set sashelp.class (keep=Height Sex Name);
run;

data lll /view=lll;

	set sashelp.class (keep=Height Sex Name);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_0-1616440160836.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56269iDE276F4C93123DA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="My97_0-1616440160836.png" alt="My97_0-1616440160836.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And when I open the file "lll", I have something that from your comment, it should not happen:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_1-1616440221533.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56270i84D436541A927D91/image-size/large?v=v2&amp;amp;px=999" role="button" title="My97_1-1616440221533.png" alt="My97_1-1616440221533.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728261#M226594</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-22T19:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728264#M226596</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for your dedicated explanation, now I get the point.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're welcome. I'm glad to hear that.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Regarding the sas7bvew and sas7bdat, I saved them to my desktop, opening them but can't see the difference as you documented, could you please help me to have a look please?&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The jjj.sas7bdat looks good, but you need to scroll down to see the character values ("Alfred", etc.) and still further down to see the metadata ("Name", etc.). There's a &lt;EM&gt;lot&lt;/EM&gt; of white space (consisting of '00'x characters) in the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you haven't shown the hhh.sas7bvew file, though. Both the icon (obviously the same as that of jjj.sas7bdat; the icon of the view should contain a magnifying glass) and the text "DATA" in your screenshot indicate that you opened a .sas7b&lt;STRONG&gt;dat&lt;/STRONG&gt; file instead. The real hhh.sas7bvew file will have the text "VIEW" in place of "DATA".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;As to the &lt;FONT face="courier new,courier"&gt;lll&lt;/FONT&gt; file: Again, you are looking at a .sas7b&lt;STRONG&gt;dat&lt;/STRONG&gt; file.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728264#M226596</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-22T19:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728268#M226598</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your explanation, can I ask how can I save a file under sas7bvew then? From the drop-down window, I can only see sas7bdat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:19:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728268#M226598</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-22T19:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728274#M226600</link>
      <description>&lt;P&gt;There's no need for extra "Save" or "Save as" actions. Just use the Windows Explorer to navigate to the WORK library and then open the .sas7bvew file with Notepad. To find out the physical path of the WORK library you can use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %sysfunc(pathname(work));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which will write the path to the log. In my default local SAS EG installation (which I normally don't use, therefore it's not customized) the path contains 11 (eleven!) subfolder names.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728274#M226600</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-22T19:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728277#M226601</link>
      <description>&lt;P&gt;Just look at the files using SAS code instead of some random GUI tool.&lt;/P&gt;
&lt;P&gt;Make a view and a dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myview / view=myview ;
  set sashelp.class;
run;
data mydata ;
  set sashelp.class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Look at them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile "%sysfunc(pathname(work))/myview.sas7bvew" recfm=f lrecl=80;
  input;
  list;
run;
data _null_;
  infile "%sysfunc(pathname(work))/mydata.sas7bdat" recfm=f lrecl=80;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728277#M226601</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-22T19:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728278#M226602</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am wondering how come you remember exactly each code like that, I am overwhelmed by how fast you reply to me, can I ask about the experience though? Because it takes me time to remember the codes .....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Respect and warm regards.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:38:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728278#M226602</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-22T19:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728279#M226603</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A great way for me to read the file by using log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;
&lt;P&gt;Phil.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728279#M226603</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-22T19:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: how come we proc sort with a view?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728292#M226606</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am wondering how come you remember exactly each code like that, I am overwhelmed by how fast you reply to me, can I ask about the experience though?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I started with SAS 6.12 in 1997 and haven't finished learning yet, although I've been programming in SAS in each and every job/project since then. The amount of SAS-related topics that I'm planning to learn is still immense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck with your studies!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 20:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-come-we-proc-sort-with-a-view/m-p/728292#M226606</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-22T20:19:09Z</dc:date>
    </item>
  </channel>
</rss>

