<?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 libref not assigned error when using distinct in a proc sql sas view in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541209#M149391</link>
    <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;A view was created with the following definition (pulled from the describe view output)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;select *&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;from TMPLIBPT.DREAM&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;using libname tmplibpt "/hardpath/datasets/hideit" access = readonly filelocks = none;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;When I do a select to get data the sql works fine.&amp;nbsp; &lt;FONT face="Arial"&gt;When I add the distinct keyword I get an error saying the libname isn't assigned, but the step is still run.&amp;nbsp; Trying to figure out why.&amp;nbsp; I am pretty new to working with views.&amp;nbsp; Can someone help me understand this?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT face="Arial"&gt;Here is the code:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib '/aas/hardpath/datasets';

data check1;
     set mylib.dream;
     where checkfld = "xxxx";
run;

proc sql;
     create table check2 as select checkfld from mylib.dream
     where checkfld = "xxxx";
quit;

proc sql;
     create table check3 as select distinct checkfld from mylib.dream
     where checkfld = "xxxx";
quit;

proc sql;
describe view mylib.dream;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;25         GOPTIONS ACCESSIBLE;
26         libname mylib '/aas/hardpath/datasets';
NOTE: Libref MYLIB was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: /aas/hardpath/datasets
27         
28         /*proc sql;*/
29         /*create view mylib.dream as*/
30         /*   select * from TMPLIBPT.DREAM using libname tmplibpt '/aas/hardpath/datasets/hideit' access = readonly filelocks =
30       ! none;*/
31         /*quit;*/
32         
33         data check1;
34              set mylib.dream;
35              where checkfld = "xxxx";
36         run;

1                                                          The SAS System                         10:55 Wednesday, February 27, 2019

INFO: Index checkfld selected for WHERE clause optimization.
NOTE: There were 102084 observations read from the data set TMPLIBPT.DREAM.
      WHERE checkfld='xxxx';
NOTE: There were 102084 observations read from the data set MYLIB.DREAM.
      WHERE checkfld='xxxx';
NOTE: The data set WORK.CHECK1 has 102084 observations and 11 variables.
NOTE: Compressing data set WORK.CHECK1 increased size by 12.87 percent. 
      Compressed is 114 pages; un-compressed would require 101 pages.
NOTE: DATA statement used (Total process time):
      real time           0.10 seconds
      user cpu time       0.10 seconds
      system cpu time     0.01 seconds
      memory              6003.15k
      OS Memory           28328.00k
      Timestamp           02/27/2019 11:55:08 AM
      Step Count                        15  Switch Count  33
      Page Faults                       0
      Page Reclaims                     227
      Page Swaps                        0
2                                                          The SAS System                         10:55 Wednesday, February 27, 2019

      Voluntary Context Switches        98
      Involuntary Context Switches      1
      Block Input Operations            0
      Block Output Operations           14648
      

37         
38         proc sql;
39              create table check2 as select checkfld from mylib.dream
40              where checkfld = "xxxx";
NOTE: Compression was disabled for data set WORK.CHECK2 because compression overhead would increase the size of the data set.
1                                                          The SAS System                         10:55 Wednesday, February 27, 2019

INFO: Index checkfld selected for WHERE clause optimization.
NOTE: Table WORK.CHECK2 created, with 102084 rows and 1 columns.

41         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.03 seconds
      user cpu time       0.03 seconds
      system cpu time     0.00 seconds
      memory              5681.03k
      OS Memory           28584.00k
      Timestamp           02/27/2019 11:55:08 AM
      Step Count                        16  Switch Count  3
      Page Faults                       0
      Page Reclaims                     49
      Page Swaps                        0
      Voluntary Context Switches        18
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           1336
      

42         
43         proc sql;
44              create table check3 as select distinct checkfld from mylib.dream
45              where checkfld = "xxxx";
ERROR: Libref TMPLIBPT is not assigned.
INFO: Index checkfld of SQL table TMPLIBPT.DREAM selected for SQL SELECT DISTINCT/UNIQUE optimization.
NOTE: Compression was disabled for data set WORK.CHECK3 because compression overhead would increase the size of the data set.
NOTE: Table WORK.CHECK3 created, with 1 rows and 1 columns.

46         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      user cpu time       0.01 seconds
      system cpu time     0.01 seconds
      memory              5681.03k
      OS Memory           28584.00k
      Timestamp           02/27/2019 11:55:08 AM
      Step Count                        17  Switch Count  2
      Page Faults                       0
      Page Reclaims                     26
      Page Swaps                        0
      Voluntary Context Switches        20
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           184
      

3                                                          The SAS System                         10:55 Wednesday, February 27, 2019

47         
48         proc sql;
49         describe view mylib.dream;
NOTE: SQL view MYLIB.DREAM is defined as:

        select *
          from TMPLIBPT.DREAM
         using libname tmplibpt '/aas/hardpath/datasets/hideit' access = readonly filelocks = none;

50         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              406.71k
      OS Memory           23460.00k
      Timestamp           02/27/2019 11:55:08 AM
      Step Count                        18  Switch Count  0
      Page Faults                       0
      Page Reclaims                     16
      Page Swaps                        0
      Voluntary Context Switches        3
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           48
      &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2019 20:18:57 GMT</pubDate>
    <dc:creator>cckesler</dc:creator>
    <dc:date>2019-03-07T20:18:57Z</dc:date>
    <item>
      <title>libref not assigned error when using distinct in a proc sql sas view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541209#M149391</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;A view was created with the following definition (pulled from the describe view output)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;select *&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;from TMPLIBPT.DREAM&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;using libname tmplibpt "/hardpath/datasets/hideit" access = readonly filelocks = none;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;When I do a select to get data the sql works fine.&amp;nbsp; &lt;FONT face="Arial"&gt;When I add the distinct keyword I get an error saying the libname isn't assigned, but the step is still run.&amp;nbsp; Trying to figure out why.&amp;nbsp; I am pretty new to working with views.&amp;nbsp; Can someone help me understand this?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT face="Arial"&gt;Here is the code:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib '/aas/hardpath/datasets';

data check1;
     set mylib.dream;
     where checkfld = "xxxx";
run;

proc sql;
     create table check2 as select checkfld from mylib.dream
     where checkfld = "xxxx";
quit;

proc sql;
     create table check3 as select distinct checkfld from mylib.dream
     where checkfld = "xxxx";
quit;

proc sql;
describe view mylib.dream;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;25         GOPTIONS ACCESSIBLE;
26         libname mylib '/aas/hardpath/datasets';
NOTE: Libref MYLIB was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: /aas/hardpath/datasets
27         
28         /*proc sql;*/
29         /*create view mylib.dream as*/
30         /*   select * from TMPLIBPT.DREAM using libname tmplibpt '/aas/hardpath/datasets/hideit' access = readonly filelocks =
30       ! none;*/
31         /*quit;*/
32         
33         data check1;
34              set mylib.dream;
35              where checkfld = "xxxx";
36         run;

1                                                          The SAS System                         10:55 Wednesday, February 27, 2019

INFO: Index checkfld selected for WHERE clause optimization.
NOTE: There were 102084 observations read from the data set TMPLIBPT.DREAM.
      WHERE checkfld='xxxx';
NOTE: There were 102084 observations read from the data set MYLIB.DREAM.
      WHERE checkfld='xxxx';
NOTE: The data set WORK.CHECK1 has 102084 observations and 11 variables.
NOTE: Compressing data set WORK.CHECK1 increased size by 12.87 percent. 
      Compressed is 114 pages; un-compressed would require 101 pages.
NOTE: DATA statement used (Total process time):
      real time           0.10 seconds
      user cpu time       0.10 seconds
      system cpu time     0.01 seconds
      memory              6003.15k
      OS Memory           28328.00k
      Timestamp           02/27/2019 11:55:08 AM
      Step Count                        15  Switch Count  33
      Page Faults                       0
      Page Reclaims                     227
      Page Swaps                        0
2                                                          The SAS System                         10:55 Wednesday, February 27, 2019

      Voluntary Context Switches        98
      Involuntary Context Switches      1
      Block Input Operations            0
      Block Output Operations           14648
      

37         
38         proc sql;
39              create table check2 as select checkfld from mylib.dream
40              where checkfld = "xxxx";
NOTE: Compression was disabled for data set WORK.CHECK2 because compression overhead would increase the size of the data set.
1                                                          The SAS System                         10:55 Wednesday, February 27, 2019

INFO: Index checkfld selected for WHERE clause optimization.
NOTE: Table WORK.CHECK2 created, with 102084 rows and 1 columns.

41         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.03 seconds
      user cpu time       0.03 seconds
      system cpu time     0.00 seconds
      memory              5681.03k
      OS Memory           28584.00k
      Timestamp           02/27/2019 11:55:08 AM
      Step Count                        16  Switch Count  3
      Page Faults                       0
      Page Reclaims                     49
      Page Swaps                        0
      Voluntary Context Switches        18
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           1336
      

42         
43         proc sql;
44              create table check3 as select distinct checkfld from mylib.dream
45              where checkfld = "xxxx";
ERROR: Libref TMPLIBPT is not assigned.
INFO: Index checkfld of SQL table TMPLIBPT.DREAM selected for SQL SELECT DISTINCT/UNIQUE optimization.
NOTE: Compression was disabled for data set WORK.CHECK3 because compression overhead would increase the size of the data set.
NOTE: Table WORK.CHECK3 created, with 1 rows and 1 columns.

46         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      user cpu time       0.01 seconds
      system cpu time     0.01 seconds
      memory              5681.03k
      OS Memory           28584.00k
      Timestamp           02/27/2019 11:55:08 AM
      Step Count                        17  Switch Count  2
      Page Faults                       0
      Page Reclaims                     26
      Page Swaps                        0
      Voluntary Context Switches        20
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           184
      

3                                                          The SAS System                         10:55 Wednesday, February 27, 2019

47         
48         proc sql;
49         describe view mylib.dream;
NOTE: SQL view MYLIB.DREAM is defined as:

        select *
          from TMPLIBPT.DREAM
         using libname tmplibpt '/aas/hardpath/datasets/hideit' access = readonly filelocks = none;

50         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              406.71k
      OS Memory           23460.00k
      Timestamp           02/27/2019 11:55:08 AM
      Step Count                        18  Switch Count  0
      Page Faults                       0
      Page Reclaims                     16
      Page Swaps                        0
      Voluntary Context Switches        3
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           48
      &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 20:18:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541209#M149391</guid>
      <dc:creator>cckesler</dc:creator>
      <dc:date>2019-03-07T20:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: libref not assigned error when using distinct in a proc sql sas view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541252#M149404</link>
      <description>&lt;P&gt;That's an odd one.&lt;/P&gt;
&lt;P&gt;Do you still get the error if you assign the library with an uppercase libname, since that's what was used when creating the view?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 22:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541252#M149404</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-03-07T22:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: libref not assigned error when using distinct in a proc sql sas view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541411#M149470</link>
      <description>&lt;P&gt;Yes, the error is the same no matter the case of the libname.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 14:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541411#M149470</guid>
      <dc:creator>cckesler</dc:creator>
      <dc:date>2019-03-08T14:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: libref not assigned error when using distinct in a proc sql sas view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541778#M149650</link>
      <description>&lt;P&gt;The old path seems to include a&amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;hideit&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;folder&amp;nbsp; \that's absent from the new path.&lt;/P&gt;
&lt;P&gt;I have no clue why the libname should not be sufficient, but you could create a link to the new folder there.&lt;/P&gt;
&lt;P&gt;Ask tech support if no one here knows, and please keep us updated?&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>Sun, 10 Mar 2019 04:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541778#M149650</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-03-10T04:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: libref not assigned error when using distinct in a proc sql sas view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541841#M149685</link>
      <description>&lt;P&gt;Is this issue reproducible?&amp;nbsp; Or was this just just a one-time failure?&lt;/P&gt;
&lt;P&gt;If you can recreate it then report it to SAS support.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Mar 2019 17:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libref-not-assigned-error-when-using-distinct-in-a-proc-sql-sas/m-p/541841#M149685</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-10T17:33:33Z</dc:date>
    </item>
  </channel>
</rss>

