<?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: Problem reading gz zipped file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-gz-zipped-file/m-p/31535#M6041</link>
    <description>I would expect you have some information about the zip contents, to be provided by the individual sending the information.  &lt;BR /&gt;
&lt;BR /&gt;
Have you searched the Internet using the file extension "gz" and some other related keywords?  That approach may provide some revealing information.&lt;BR /&gt;
&lt;BR /&gt;
Once you get the file unzipped, you can code a simple SAS DATA step to interrogate the first few rows, as shown below:&lt;BR /&gt;
&lt;BR /&gt;
filename indata '&amp;lt;_your_input_data_file_named_here_';&lt;BR /&gt;
data _null_;&lt;BR /&gt;
infile indata;&lt;BR /&gt;
input;&lt;BR /&gt;
list;&lt;BR /&gt;
if _n_ = 10 then stop;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
From there, you have some options for importing the data, depending on the file-layout and field-delimiter structure.  Suggest you look at SAS PROC IMPORT and also the SAS DATA step approach (more control, but requires more coding).  The SAS Support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website has SAS-hosted Documentation and also supplemental technical / conference papers on this type of topic for your reference.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Wed, 13 May 2009 19:21:15 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-05-13T19:21:15Z</dc:date>
    <item>
      <title>Problem reading gz zipped file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-gz-zipped-file/m-p/31534#M6040</link>
      <description>Hi everyone,&lt;BR /&gt;
                    I have a file "test.txt.gz". I want to create a SAS dataset. I am using SAS 9.2 for Linux and Unix.&lt;BR /&gt;
&lt;BR /&gt;
     1&amp;gt; How do I unzip the file.&lt;BR /&gt;
     2&amp;gt; Find out what variables are in the file and the delimiter&lt;BR /&gt;
     3&amp;gt; Create SAS dataset.&lt;BR /&gt;
&lt;BR /&gt;
  Thanks,&lt;BR /&gt;
&lt;BR /&gt;
  Amit</description>
      <pubDate>Wed, 13 May 2009 17:57:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-gz-zipped-file/m-p/31534#M6040</guid>
      <dc:creator>AmitKB</dc:creator>
      <dc:date>2009-05-13T17:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading gz zipped file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-gz-zipped-file/m-p/31535#M6041</link>
      <description>I would expect you have some information about the zip contents, to be provided by the individual sending the information.  &lt;BR /&gt;
&lt;BR /&gt;
Have you searched the Internet using the file extension "gz" and some other related keywords?  That approach may provide some revealing information.&lt;BR /&gt;
&lt;BR /&gt;
Once you get the file unzipped, you can code a simple SAS DATA step to interrogate the first few rows, as shown below:&lt;BR /&gt;
&lt;BR /&gt;
filename indata '&amp;lt;_your_input_data_file_named_here_';&lt;BR /&gt;
data _null_;&lt;BR /&gt;
infile indata;&lt;BR /&gt;
input;&lt;BR /&gt;
list;&lt;BR /&gt;
if _n_ = 10 then stop;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
From there, you have some options for importing the data, depending on the file-layout and field-delimiter structure.  Suggest you look at SAS PROC IMPORT and also the SAS DATA step approach (more control, but requires more coding).  The SAS Support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website has SAS-hosted Documentation and also supplemental technical / conference papers on this type of topic for your reference.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 13 May 2009 19:21:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-gz-zipped-file/m-p/31535#M6041</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-13T19:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading gz zipped file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-gz-zipped-file/m-p/31536#M6042</link>
      <description>If you are on a Unix/Linux system, gz files can be read in using a 'pipe' type of filename statement.  Using a pipe you can use the file directly and do not have to unzip the file on disk to use it.  This technique also works with .zip files.&lt;BR /&gt;
&lt;BR /&gt;
Sample for reading in a :&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;filename &lt;/B&gt;filein &lt;B&gt;pipe&lt;/B&gt; "&lt;B&gt;gunzip -c&lt;/B&gt; ~/some_dirname/some_filename.csv.gz" ;&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;data&lt;/B&gt; mydata ;&lt;BR /&gt;
&lt;BR /&gt;
  &lt;B&gt; infile&lt;/B&gt; filein DSD ;&lt;BR /&gt;
&lt;BR /&gt;
   &lt;B&gt;input&lt;/B&gt; field1&lt;BR /&gt;
           field2 $&lt;BR /&gt;
           field3 $&lt;BR /&gt;
           ...&lt;BR /&gt;
           fieldn ;&lt;BR /&gt;
run ;</description>
      <pubDate>Thu, 14 May 2009 21:49:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-gz-zipped-file/m-p/31536#M6042</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-05-14T21:49:27Z</dc:date>
    </item>
  </channel>
</rss>

