<?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: Is a LIBNAME really needed to read in a file (SAS OnDemand)? in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Is-a-LIBNAME-really-needed-to-read-in-a-file-SAS-OnDemand/m-p/529346#M6891</link>
    <description>&lt;P&gt;A LIBNAME statement is used for a different thing than the DATAFILE= option on PROC IMPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a big difference between storing a SAS dataset and storing a delimited text file, such as a CSV file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A CSV file does not contain any metadata about the variables.&amp;nbsp; At best it has a header row that can be used as source for guessing what names to use for the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A SAS dataset will allow you to store the variable type, length. Attach any formats or labels to the variables.&lt;/P&gt;
&lt;P&gt;Then when you want to use it again you can skip the step of converting the text file into data.&amp;nbsp; Instead you can use a libname statement to create a libref that points to the folder that contains the dataset.&amp;nbsp; Or you can just skip the LIBNAME statement and use the name of the file that contains the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So on day 1 you run this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT
  DATAFILE="/home/doylejm/Ec385S19/house.csv" DBMS=csv
  OUT="/home/doylejm/Ec385S19/house"  replace
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then on day 1,2,3,..... you can just start with this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data for_print;
  set "/home/doylejm/Ec385S19/house"  ;
  newprice = price*100;
run;

proc print data=for_print;
title  'TABLE 4.1 HOUSE PRICES';
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jan 2019 06:33:27 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-01-23T06:33:27Z</dc:date>
    <item>
      <title>Is a LIBNAME really needed to read in a file (SAS OnDemand)?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Is-a-LIBNAME-really-needed-to-read-in-a-file-SAS-OnDemand/m-p/529317#M6889</link>
      <description>&lt;P&gt;I have my students using SAS OnDemand for some simple tasks.&amp;nbsp; Is it really necessary to create a library and a LIBNAME for the datafile?&amp;nbsp; I uploaded a .csv file to a folder in my OnDemand folders, and then use the path and filename in the PROC IMPORT DATAFILE" " command as shown below.&amp;nbsp; I typically do the same thing with SAS on the PC.&amp;nbsp; I guess I am asking why I need a Library and LIBNAME for a simple program that imports a single, simple datafile?&amp;nbsp; Doesn't the path do the same thing....why the extra steps?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;doylejm&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC IMPORT DATAFILE="/home/doylejm/Ec385S19/house.csv"&lt;BR /&gt; DBMS=csv&lt;BR /&gt; OUT=mydat replace;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;PROC CONTENTS;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;DATA mydat2;&lt;BR /&gt; SET mydat;&lt;/P&gt;
&lt;P&gt;NEWPRICE = PRICE*1000;&lt;/P&gt;
&lt;P&gt;PROC PRINT;&lt;BR /&gt; TITLE 'TABLE 4.1 HOUSE PRICES';&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 02:38:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Is-a-LIBNAME-really-needed-to-read-in-a-file-SAS-OnDemand/m-p/529317#M6889</guid>
      <dc:creator>doylejm</dc:creator>
      <dc:date>2019-01-23T02:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Is a LIBNAME really needed to read in a file (SAS OnDemand)?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Is-a-LIBNAME-really-needed-to-read-in-a-file-SAS-OnDemand/m-p/529320#M6890</link>
      <description>You don't need one, but it's helpful for avoiding to have to re-read the same data set every time.</description>
      <pubDate>Wed, 23 Jan 2019 03:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Is-a-LIBNAME-really-needed-to-read-in-a-file-SAS-OnDemand/m-p/529320#M6890</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-23T03:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Is a LIBNAME really needed to read in a file (SAS OnDemand)?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Is-a-LIBNAME-really-needed-to-read-in-a-file-SAS-OnDemand/m-p/529346#M6891</link>
      <description>&lt;P&gt;A LIBNAME statement is used for a different thing than the DATAFILE= option on PROC IMPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a big difference between storing a SAS dataset and storing a delimited text file, such as a CSV file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A CSV file does not contain any metadata about the variables.&amp;nbsp; At best it has a header row that can be used as source for guessing what names to use for the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A SAS dataset will allow you to store the variable type, length. Attach any formats or labels to the variables.&lt;/P&gt;
&lt;P&gt;Then when you want to use it again you can skip the step of converting the text file into data.&amp;nbsp; Instead you can use a libname statement to create a libref that points to the folder that contains the dataset.&amp;nbsp; Or you can just skip the LIBNAME statement and use the name of the file that contains the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So on day 1 you run this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT
  DATAFILE="/home/doylejm/Ec385S19/house.csv" DBMS=csv
  OUT="/home/doylejm/Ec385S19/house"  replace
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then on day 1,2,3,..... you can just start with this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data for_print;
  set "/home/doylejm/Ec385S19/house"  ;
  newprice = price*100;
run;

proc print data=for_print;
title  'TABLE 4.1 HOUSE PRICES';
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 06:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Is-a-LIBNAME-really-needed-to-read-in-a-file-SAS-OnDemand/m-p/529346#M6891</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-23T06:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is a LIBNAME really needed to read in a file (SAS OnDemand)?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Is-a-LIBNAME-really-needed-to-read-in-a-file-SAS-OnDemand/m-p/529477#M6901</link>
      <description>&lt;P&gt;Any SAS data set is always stored in a Library somewhere. If you only use a one level name the default is the WORK library which means that the data set will be removed at the end of the SAS session by default. So assigning a specific library location other than work means that you can continue where you left off and all of the data is available after a libname statement is used to reference the location(s). There are several ways depending on your installation to have libraries assigned at start of your SAS session.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 18:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Is-a-LIBNAME-really-needed-to-read-in-a-file-SAS-OnDemand/m-p/529477#M6901</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-23T18:16:41Z</dc:date>
    </item>
  </channel>
</rss>

