<?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: Import a sas data set using data step in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/504996#M1074</link>
    <description>&lt;P&gt;I strongly suggest you take the free Programming 1 E-Learning Course: &lt;A href="https://support.sas.com/edu/schedules.html?ctry=us&amp;amp;crs=PROG1#s1=1" target="_blank"&gt;https://support.sas.com/edu/schedules.html?ctry=us&amp;amp;crs=PROG1#s1=1&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It will provide answers to this and other typical beginner questions.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2018 08:34:41 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-10-17T08:34:41Z</dc:date>
    <item>
      <title>Import a sas data set using data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/504988#M1071</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone please confirm, if we can use &lt;STRONG&gt;data step&lt;/STRONG&gt; to import a data set using &lt;STRONG&gt;programming&lt;/STRONG&gt; in &lt;STRONG&gt;SAS enterprise guide&lt;/STRONG&gt;? The data set is a &lt;STRONG&gt;SAS data set&lt;/STRONG&gt;. We do not have to use &lt;STRONG&gt;proc import&lt;/STRONG&gt;. Only by using a &lt;STRONG&gt;data step&lt;/STRONG&gt;. Please share the code, if possible&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 08:11:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/504988#M1071</guid>
      <dc:creator>anubhav_200</dc:creator>
      <dc:date>2018-10-17T08:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Import a sas data set using data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/504993#M1072</link>
      <description>&lt;P&gt;You don't import a SAS dataset you just read it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname MyLibRef "c:\MyFolderWithSASData";

data MyDataset;
  set MyLibRef.MyDataset;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2018 08:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/504993#M1072</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-10-17T08:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Import a sas data set using data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/504995#M1073</link>
      <description>&lt;P&gt;You do not import a SAS dataset, you just use it.&lt;/P&gt;
&lt;P&gt;Copy the .sas7bdat file to a location that your SAS process has access to, define a libname for that location (if such has not already been defined), and you can use libname.dataset in any place where you want to use your data.&lt;/P&gt;
&lt;P&gt;eg:&lt;/P&gt;
&lt;PRE&gt;copy x:\somewhere\test.sas7bdat c:\temp&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname temp 'C:\temp';

proc print data=temp.test;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2018 08:25:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/504995#M1073</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-17T08:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Import a sas data set using data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/504996#M1074</link>
      <description>&lt;P&gt;I strongly suggest you take the free Programming 1 E-Learning Course: &lt;A href="https://support.sas.com/edu/schedules.html?ctry=us&amp;amp;crs=PROG1#s1=1" target="_blank"&gt;https://support.sas.com/edu/schedules.html?ctry=us&amp;amp;crs=PROG1#s1=1&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It will provide answers to this and other typical beginner questions.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 08:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/504996#M1074</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-17T08:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Import a sas data set using data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/505459#M1169</link>
      <description>&lt;P&gt;Thanks Kurt!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just wanted to confirm that do we use the term importing or just reading the data set when we use a data step. Thanks for the response; it clarifies my doubt.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 08:25:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/505459#M1169</guid>
      <dc:creator>anubhav_200</dc:creator>
      <dc:date>2018-10-18T08:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Import a sas data set using data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/505461#M1170</link>
      <description>&lt;P&gt;A doubt in the answer that you have shared!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose the data set is not a &lt;STRONG&gt;.sas7bdat&lt;/STRONG&gt; file. Can we use a data step to read any data set, which is not in&lt;STRONG&gt; .sas7bdat&lt;/STRONG&gt; file, say, a &lt;STRONG&gt;CSV&lt;/STRONG&gt; file?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 08:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/505461#M1170</guid>
      <dc:creator>anubhav_200</dc:creator>
      <dc:date>2018-10-18T08:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Import a sas data set using data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/505462#M1171</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You do not import a SAS dataset, you just use it.&amp;nbsp;Copy the .sas7bdat file to a location that your SAS process has access to, define a libname for that location (if such has not already been defined), and you can use libname.dataset any place in your SAS code to use your data.&lt;/P&gt;
&lt;P&gt;eg:&lt;/P&gt;
&lt;PRE&gt;copy x:\somewhere\test.sas7bdat c:\temp&lt;/PRE&gt;
&lt;LI-CODE lang="sas"&gt;libname temp 'C:\temp';

proc print data=temp.test;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/216855" target="_blank"&gt;&lt;FONT color="#3366FF"&gt;@anubhav_200&lt;/FONT&gt;&lt;/A&gt;&lt;FONT color="#3366FF"&gt;&lt;SPAN&gt;&amp;nbsp;wrote:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;Suppose the data set is not a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;.sas7bdat&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file. Can we use a data step to read any data set, which is not in&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;.sas7bdat&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file, say, a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;CSV&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file?&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Yes. You not only CAN use the data step for this, you MUST use it. Even if you use the helper procedure &lt;FONT face="courier new,courier"&gt;proc import&lt;/FONT&gt;, it creates and runs a data step behind the scenes (you can take it from the log).&lt;/P&gt;
&lt;P&gt;So imagine a csv file like this:&lt;/P&gt;
&lt;PRE&gt;id,date,sum
A,2018-10-18,5&lt;/PRE&gt;
&lt;P&gt;the data step to read it would look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
infile "location/name.csv" dlm=',' firstobs=2;
input
  id $
  date :yymmdd10.
  sum
;
format date yymmddd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Editor's Note:&lt;BR /&gt;Multiple responses were consolidated here to make the complete and final solution more accessible to future answer seekers&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 14:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/505462#M1171</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-10T14:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Import a sas data set using data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/505463#M1172</link>
      <description>&lt;P&gt;Thanks, Kurt! I will try using the code shared by you.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 08:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-a-sas-data-set-using-data-step/m-p/505463#M1172</guid>
      <dc:creator>anubhav_200</dc:creator>
      <dc:date>2018-10-18T08:40:42Z</dc:date>
    </item>
  </channel>
</rss>

