<?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: anyone can please answer how to reference dataset in library with %let statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704476#M215966</link>
    <description>Thank you for your response, now i got correct output</description>
    <pubDate>Tue, 08 Dec 2020 17:55:40 GMT</pubDate>
    <dc:creator>vidyapedii</dc:creator>
    <dc:date>2020-12-08T17:55:40Z</dc:date>
    <item>
      <title>anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704249#M215879</link>
      <description>&lt;P&gt;I got this question on practise exams for certification, i set dataset (&amp;amp;library) without&amp;nbsp; double quotation it didnt work for me, when i used&amp;nbsp;&amp;nbsp;"&amp;amp;library" i could create the dataset.&lt;/P&gt;&lt;P&gt;But answer i got in SAS site is -&amp;nbsp;&amp;amp;library without double quotes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Complete the code below to reference a data set named&amp;nbsp;&lt;STRONG&gt;data_in&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;that is contained in the library&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;cert&lt;/STRONG&gt;. You must use the macro variable defined in the program in place of the library name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let library = cert.data_in; libname cert "C:\workshop\cert";&lt;/P&gt;&lt;P&gt;data work.data_out; set Answer; run;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 19:11:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704249#M215879</guid>
      <dc:creator>vidyapedii</dc:creator>
      <dc:date>2020-12-07T19:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704267#M215886</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;i set dataset (&amp;amp;library) without&amp;nbsp; double quotation it didnt work for me&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Can you show us your log? It should work without the quotes:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.data_out; 
   set &amp;amp;library; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Dec 2020 19:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704267#M215886</guid>
      <dc:creator>vellad</dc:creator>
      <dc:date>2020-12-07T19:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704270#M215887</link>
      <description>&lt;BR /&gt;i am getting error like this&lt;BR /&gt;&lt;BR /&gt;73 %let library=/home/vidyapedii0/CERT/INPUT/input04;&lt;BR /&gt;74 data let;&lt;BR /&gt;75 set &amp;amp;library;&lt;BR /&gt;NOTE: Line generated by the macro variable "LIBRARY".&lt;BR /&gt;75 /home/vidyapedii0/CERT/INPUT/input04&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, CUROBS, END, INDSNAME, KEY, KEYRESET, KEYS,&lt;BR /&gt;NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.</description>
      <pubDate>Mon, 07 Dec 2020 20:06:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704270#M215887</guid>
      <dc:creator>vidyapedii</dc:creator>
      <dc:date>2020-12-07T20:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704271#M215888</link>
      <description>&lt;DIV class="sasSource"&gt;i can read the data with "&amp;amp;library" in set statement&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 %let library=/home/vidyapedii0/CERT/INPUT/input04;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 data let;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 set "&amp;amp;library";&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Data file CERT.INPUT04.DATA is in a format that is native to another host, or the file encoding does not match the session&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;performance.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 20 observations read from the data set /home/vidyapedii0/CERT/INPUT/input04.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.LET has 20 observations and 15 variables.&lt;/DIV&gt;</description>
      <pubDate>Mon, 07 Dec 2020 20:09:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704271#M215888</guid>
      <dc:creator>vidyapedii</dc:creator>
      <dc:date>2020-12-07T20:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704273#M215889</link>
      <description>&lt;P&gt;You can reference a SAS dataset in two ways:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;by supplying the complete physical path as a string (in quotes)&lt;/LI&gt;
&lt;LI&gt;by using a library and a dataset name, separated by a period; here no quotes are used&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;The second method is preferred; first assign the libname, then use the libname.dataset in the SET statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname input "/home/vidyapedii0/CERT/INPUT";

data let;
set input.input04;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can see that this SET statement is easier to read than one with the full path in quotes.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 20:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704273#M215889</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-07T20:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704277#M215890</link>
      <description>&lt;P&gt;Why do you need to change the macro variable definition from what's been given? It is given as &lt;EM&gt;cert.data_in&lt;/EM&gt; but you are changing to the physical path, which won't work with the set statement without the quotes! Try it the way I suggested in my previous post.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 20:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704277#M215890</guid>
      <dc:creator>vellad</dc:creator>
      <dc:date>2020-12-07T20:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704278#M215891</link>
      <description>&lt;P&gt;It is hard to tell from your question but I think the purpose of the question was to get you to say want text should replace the string &lt;STRONG&gt;Answer&lt;/STRONG&gt; in this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname cert "C:\workshop\cert";
data work.data_out;
  set Answer; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is no need to create or reference a macro variable LIBRARY.&amp;nbsp; Instead you want to reference the libref CERT that the code created in the LIBNAME statement.&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname cert "C:\workshop\cert";
data work.data_out;
  set cert.data_in; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 20:46:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704278#M215891</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-07T20:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704317#M215908</link>
      <description>&lt;P&gt;Hi, Thankyou for the response,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let library=&amp;nbsp;/home/vidyapedii0/CERT/INPUT/input04;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created macro named "library" to reference the "input04" dataset in Cert library, i used "&amp;amp;library" in set statement to create another dataset.&lt;/P&gt;&lt;P&gt;which is the correct way to use macro var library with quotes ( ex-"&amp;amp;library")&amp;nbsp; or without quotes&amp;nbsp; (ex -&amp;nbsp; &amp;amp;library)&lt;/P&gt;&lt;P&gt;i got this question in practise exam, answer they have mentioned is without quotes(&amp;amp;library), but i couldn't create the dataset when i used macro variable without quotes (&amp;amp;library)&lt;/P&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;%let library=/home/vidyapedii0/CERT/INPUT/input04;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;data let;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;set "&amp;amp;library";&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;run;&lt;/DIV&gt;</description>
      <pubDate>Tue, 08 Dec 2020 00:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704317#M215908</guid>
      <dc:creator>vidyapedii</dc:creator>
      <dc:date>2020-12-08T00:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704349#M215921</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/129883"&gt;@vidyapedii&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, Thankyou for the response,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let library=&amp;nbsp;/home/vidyapedii0/CERT/INPUT/input04;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created macro named "library" to reference the "input04" dataset in Cert library, i used "&amp;amp;library" in set statement to create another dataset.&lt;/P&gt;
&lt;P&gt;which is the correct way to use macro var library with quotes ( ex-"&amp;amp;library")&amp;nbsp; or without quotes&amp;nbsp; (ex -&amp;nbsp; &amp;amp;library)&lt;/P&gt;
&lt;P&gt;i got this question in practise exam, answer they have mentioned is without quotes(&amp;amp;library), but i couldn't create the dataset when i used macro variable without quotes (&amp;amp;library)&lt;/P&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;%let library=/home/vidyapedii0/CERT/INPUT/input04;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;data let;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;set "&amp;amp;library";&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;run;&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You created the macro variable LIBRARY to point to a &lt;STRONG&gt;FILE&lt;/STRONG&gt; that has the dataset INPUT04.&amp;nbsp; You made no use of a LIBRARY (or more exactly a LIBREF) named CERT.&amp;nbsp; When you reference a dataset by the filename you need to enclose the values in quote (whether or not you use any macro variable).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These example SET statements all reference the same file (and so the same dataset).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set '/home/vidyapedii0/CERT/INPUT/input04';
set "/home/vidyapedii0/CERT/INPUT/input04";
set "/home/vidyapedii0/CERT/INPUT/input04.sas7bdat";

%let filename = '/home/vidyapedii0/CERT/INPUT/input04';
set &amp;amp;filename;

%let filename = /home/vidyapedii0/CERT/INPUT/input04;
set "&amp;amp;filename";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you use a LIBNAME statement to define a libref that defines a specific library then to reference the members of that library you use a two level name without any quotes. Whether or not you use a macro varaible.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname cert '/home/vidyapedii0/CERT/INPUT/';
set cert.input04;

%let dataset_name = cert.input04;
set &amp;amp;dataset_name;

%let member_name = input04 ;
set cert.&amp;amp;member_name;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 05:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704349#M215921</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-08T05:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: anyone can please answer how to reference dataset in library with %let statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704476#M215966</link>
      <description>Thank you for your response, now i got correct output</description>
      <pubDate>Tue, 08 Dec 2020 17:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anyone-can-please-answer-how-to-reference-dataset-in-library/m-p/704476#M215966</guid>
      <dc:creator>vidyapedii</dc:creator>
      <dc:date>2020-12-08T17:55:40Z</dc:date>
    </item>
  </channel>
</rss>

