<?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: Importing dataset using one dataset that has variables information in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/244649#M45599</link>
    <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all,&amp;nbsp;thank you all for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, I've done it! I found a different (and easier) approach to this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS Guide 5.1, there is an option under the Tasks menu, Data &amp;gt; Download Data Files to PC... that allows to save sas datasets in a local directory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a very easy way to export multiple tables, it's very fast and all variable types and formats are safe because it is exported to a sas dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, in SAS Guide 4, I just have to do a simple import procedure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bruno&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jan 2016 12:05:11 GMT</pubDate>
    <dc:creator>brunosm</dc:creator>
    <dc:date>2016-01-20T12:05:11Z</dc:date>
    <item>
      <title>Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243813#M45374</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need a little help in exporting and importing some datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some tables in a library called MYDBS which were exported into a local pc folder as &lt;STRONG&gt;.tab&lt;/STRONG&gt; files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This tables have &lt;STRONG&gt;different variables and different types of variables&lt;/STRONG&gt;, which can be numeric, strings or dates. So, I decided to also export an aditional table that contains all the information about all the variables in all tables (in MYDBS library). I have done the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc contents data= MYDBS._all_ noprint out=varsDesc;
run;&lt;/PRE&gt;&lt;P&gt;Now I was thinking if it would be possible to import those .tab files, considering the variables types, formats and informats of each variable that are available in the &lt;STRONG&gt;varsDesc&lt;/STRONG&gt; table...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't need to import all the tables at once, I can import one by one. I just want to preserve the original&amp;nbsp;&lt;SPAN&gt;variables types, formats and informats.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can anyone help me? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Bruno&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 15:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243813#M45374</guid>
      <dc:creator>brunosm</dc:creator>
      <dc:date>2016-01-15T15:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243816#M45375</link>
      <description>&lt;P&gt;Exporting the data using PROC CPORT will preserve almost all metadata information about the table alongside with the data.&lt;/P&gt;
&lt;P&gt;What is the application?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 16:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243816#M45375</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-01-15T16:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243825#M45378</link>
      <description>&lt;P&gt;Hi LinusH,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that won't be possible, I will try to explain why.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm exporting the datasets using SAS Guide 5.1.&amp;nbsp;I'm working in a remote server (linux), and I'm saving the files into a windows folder, so I have to use the export wizard (i think that it won't be possible to use PROC CPORT or any kind of "code").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, I want to import the .tab files into SAS Guide 4, which I use localy. And that's why I'm having trouble in preserve variables types and formats.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, I can do it if I export into .mdb files, but I would like to save some space and time...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 16:19:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243825#M45378</guid>
      <dc:creator>brunosm</dc:creator>
      <dc:date>2016-01-15T16:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243830#M45381</link>
      <description>&lt;P&gt;You can use the information from PROC CONTENTS to write code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents noprint data=sashelp.cars out=contents;
   run;
proc sort data=contents;
   by libname memname varnum;
   run;
proc print;
   run;

data _null_;
   set contents;
   by libname memname;
   if first.memname then do;
      put 'data ' memname '(label=' memlabel:quote. ');';
      end;
   put +3 'Attrib ' name 'length=' @;
   if type eq 2 then put '$' @;
   put length @;
   if not missing(format) then do;
      format=cats(format,formatl,'.',formatd);
      put format= @;
      end;
   if not missing(informat) then informat=cats(INFORMAT,INFORML,'.',INFORMD);
   else if not missing(format) then informat=format;
   if not missing(informat) then put informat= @;
   if not missing(label) then put label=$quote. @;
   put ';';
   if last.memname then do;
      put +3 'Run;';
      end;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Jan 2016 16:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243830#M45381</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-01-15T16:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243831#M45382</link>
      <description>&lt;P&gt;How are exporting the data sets currently? CPORT should write to any File reference that Proc Export&amp;nbsp;or a data step does.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 16:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243831#M45382</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-15T16:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243835#M45383</link>
      <description>&lt;P&gt;Hi data_null__,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry for my ignorance but... how can I use what you wrote in the importation process?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you give me an example plz?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 17:05:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243835#M45383</guid>
      <dc:creator>brunosm</dc:creator>
      <dc:date>2016-01-15T17:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243836#M45384</link>
      <description>Why do you want to switch from a newer server based SAS environment to a local older one?&lt;BR /&gt;Still, CPORT is somewhat backward compatible, so why don't give it a try?</description>
      <pubDate>Fri, 15 Jan 2016 17:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243836#M45384</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-01-15T17:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243840#M45385</link>
      <description>&lt;P&gt;If you had exported the files to TAB delimited and you can make an association between the file name and data set name you could continue the program I wrote to write the INFILE statement needed to refer to the external file and INPUT statement need to read the records. &amp;nbsp;If you exported the data in VARNUM order then the input statement would be simple as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;INPUT (_ALL_)(:);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And instead of writing the generated code to the SASLOG you would write it to a file and %INC it to execute it.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 17:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243840#M45385</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-01-15T17:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243847#M45389</link>
      <description>&lt;P&gt;It's not that i dont want, it's because i have restricted access.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cant export anything unless i use the export wizard... i cant assign a libname in my computer for example.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 17:26:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243847#M45389</guid>
      <dc:creator>brunosm</dc:creator>
      <dc:date>2016-01-15T17:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243850#M45391</link>
      <description>&lt;P&gt;Don't&amp;nbsp;you have&amp;nbsp;write access to any folder on the server? If you have, CPORT....!&lt;/P&gt;
&lt;P&gt;Have you tried to export as SAS data set, the SAS data file format hasn't changed (much) between the versions you are mentioning.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 17:36:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243850#M45391</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-01-15T17:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243854#M45393</link>
      <description>&lt;P&gt;No, i don't have permission to do that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Only way to export: Right click --&amp;gt; "Export &amp;lt;table&amp;gt; as a Step In Project..."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cant do it because it says that I have to have the same version installed localy&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 17:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243854#M45393</guid>
      <dc:creator>brunosm</dc:creator>
      <dc:date>2016-01-15T17:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243886#M45403</link>
      <description>&lt;P&gt;I think the point&amp;nbsp;@Linus is trying to make is you should be able to export a CPORT file to the server, in some location that you have access to and then FTP or move them over a different way. You can usually ssh or ftp into the server via winscp but it's not a straightforward process and your IT may have turned off access somehow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That being said there's an EG add-in that would allow you to move files from the server.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/sasdummy/2012/12/06/copy-files-in-sas-eg/" target="_blank"&gt;http://blogs.sas.com/content/sasdummy/2012/12/06/copy-files-in-sas-eg/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 19:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/243886#M45403</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-15T19:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Importing dataset using one dataset that has variables information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/244649#M45599</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all,&amp;nbsp;thank you all for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, I've done it! I found a different (and easier) approach to this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS Guide 5.1, there is an option under the Tasks menu, Data &amp;gt; Download Data Files to PC... that allows to save sas datasets in a local directory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a very easy way to export multiple tables, it's very fast and all variable types and formats are safe because it is exported to a sas dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, in SAS Guide 4, I just have to do a simple import procedure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bruno&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 12:05:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-dataset-using-one-dataset-that-has-variables/m-p/244649#M45599</guid>
      <dc:creator>brunosm</dc:creator>
      <dc:date>2016-01-20T12:05:11Z</dc:date>
    </item>
  </channel>
</rss>

