<?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: Reading and Writing ZIP Files With SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896301#M354157</link>
    <description>Since it is a publicly available file,  I just attached it.  I am trying to read it in SAS Studio in Viya where I uploaded the zip file.  I am also having trouble reading the multiple excel tabs that are in the excel files that are in the zip and I found the pdf of your presentation on that as well.  So, if you could help with both reading the zip file and reading the tabs, that would be great!</description>
    <pubDate>Thu, 28 Sep 2023 17:43:33 GMT</pubDate>
    <dc:creator>telligent</dc:creator>
    <dc:date>2023-09-28T17:43:33Z</dc:date>
    <item>
      <title>Problem reading ZIP File With SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896173#M354119</link>
      <description>&lt;P&gt;Any clue as to what I am doing wrong here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ERROR: Open failure for /Users/xxxxxxx/My Folder/FiveYearNational_Awardees.zip during attempt to create a local file handle.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code&lt;/P&gt;
&lt;P&gt;Filename treat zip "/Users/xxxxxxx/My Folder/FiveYearNational_Awardees.zip";&lt;BR /&gt;filename target "%sysfunc(getoption(work))/2022_National_Awardees.xlsx" ;&lt;/P&gt;
&lt;P&gt;/* Read ZIP like a directory with DOPEN */&lt;BR /&gt;data _contents(keep=memname);&lt;BR /&gt;length memname $200;&lt;BR /&gt;fid=dopen("treat");&lt;BR /&gt;if fid=0 then stop;&lt;BR /&gt;memcount=dnum(fid);&lt;BR /&gt;do i=1 to memcount;&lt;BR /&gt;memname=dread(fid,i);&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;rc=dclose(fid);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;/* using member syntax here */&lt;BR /&gt;infile treat (2022_National_Awardees.xlsx)&lt;BR /&gt;lrecl=256 recfm=F length=length eof=eof unbuf;&lt;BR /&gt;file target lrecl=256 recfm=N;&lt;BR /&gt;input;&lt;BR /&gt;put _infile_ $varying256. length;&lt;BR /&gt;return;&lt;BR /&gt;eof:&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 12:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896173#M354119</guid>
      <dc:creator>telligent</dc:creator>
      <dc:date>2023-09-28T12:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reading and Writing ZIP Files With SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896238#M354120</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/279298"&gt;@telligent&lt;/a&gt;&amp;nbsp;Thanks for commenting on my SAS Explore presentation (&amp;nbsp;&lt;LI-MESSAGE title="Reading and Writing ZIP Files With SAS" uid="895050" url="https://communities.sas.com/t5/SAS-Explore-Presentations/Reading-and-Writing-ZIP-Files-With-SAS/m-p/895050#U895050" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error you shared isn't really enough to see what's going on. It could be the filename is incorrect (remember that case matters in a UNIX/Linux environment). But perhaps if you can share more of the log we can help.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 12:40:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896238#M354120</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2023-09-28T12:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading ZIP File With SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896245#M354124</link>
      <description>&lt;P&gt;Does "&lt;SPAN&gt;xxxxxxx&lt;/SPAN&gt;" contain any non ascii (e.g. some UTF-8) characters? Like local language letters?&lt;/P&gt;
&lt;P&gt;Is it sas 9.4M8 or lower?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 13:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896245#M354124</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-09-28T13:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading ZIP File With SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896294#M354150</link>
      <description>&lt;P&gt;No that is where my name would be.&amp;nbsp; I just deidentified it, but it is all letters.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 17:39:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896294#M354150</guid>
      <dc:creator>telligent</dc:creator>
      <dc:date>2023-09-28T17:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading and Writing ZIP Files With SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896301#M354157</link>
      <description>Since it is a publicly available file,  I just attached it.  I am trying to read it in SAS Studio in Viya where I uploaded the zip file.  I am also having trouble reading the multiple excel tabs that are in the excel files that are in the zip and I found the pdf of your presentation on that as well.  So, if you could help with both reading the zip file and reading the tabs, that would be great!</description>
      <pubDate>Thu, 28 Sep 2023 17:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896301#M354157</guid>
      <dc:creator>telligent</dc:creator>
      <dc:date>2023-09-28T17:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading ZIP File With SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896315#M354164</link>
      <description>&lt;P&gt;So where are you getting stuck?&amp;nbsp; Can you read the members in the ZIP file?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let fname=FiveYearNational_Awardees.zip;

filename xx zip "c:\downloads\&amp;amp;fname";

data names ;
  did=dopen('xx');
  do i=1 to dnum(did);
    length name $200;
    name=dread(did,i);
    output;
  end;
  did=dclose(did);
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;Obs    did    i               name

 1      1     1    2018_National_Awardees.xlsx
 2      1     2    2019_National_Awardees.xlsx
 3      1     3    2020_National_Awardees.xlsx
 4      1     4    2021_National_Awardees.xlsx
 5      1     5    2022_National_Awardees.xlsx
&lt;/PRE&gt;
&lt;P&gt;Can you copy one of the members to an actual file?&lt;/P&gt;
&lt;PRE&gt;191  filename xx;
NOTE: Fileref XX has been deassigned.
192  filename in zip "c:\downloads\&amp;amp;fname" member="2018_National_Awardees.xlsx" recfm=n lrecl=512;
193  filename out "%sysfunc(pathname(work))\2018_National_Awardees.xlsx" recfm=n lrecl=512;
194  %put rc = %sysfunc(fcopy(in,out));
rc = 0
195  filename in;
NOTE: Fileref IN has been deassigned.
196  filename out;
NOTE: Fileref OUT has been deassigned.
&lt;/PRE&gt;
&lt;P&gt;Can you copy the sheets in that XLSX file?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname in xlsx "%sysfunc(pathname(work))\2018_National_Awardees.xlsx";
proc copy inlib=in outlib=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is where I get errors because the sheets in that file have names that are not valid SAS dataset names.&lt;/P&gt;
&lt;PRE&gt;ERROR: The value 2018  AGE AND RACE-ETHNICITY is not a valid SAS name.&lt;/PRE&gt;
&lt;P&gt;So you will need to set the option VALIDMEMNAME to EXTEND to be able to use those as the name of the dataset to read.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you will also need to do more to make valid names for the datasets you want to create.&lt;/P&gt;
&lt;P&gt;You can use PROC CONTENTS (or dictionary views) to get the list of MEMNAME's in the XLSX file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use those to generate code to create SAS datasets with valid names.&lt;/P&gt;
&lt;PRE&gt;875  data test;
876    set in.'2018  AGE AND RACE-ETHNICITY'n ;
NOTE:    Variable Name Change.  Health Center Name -&amp;gt; Health_Center_Name
NOTE:    Variable Name Change.  Total Patients -&amp;gt; Total_Patients
NOTE:    Variable Name Change.  Children (&amp;lt; 18 years old) -&amp;gt; VAR5
NOTE:    Variable Name Change.  Adult (18 - 64) -&amp;gt; VAR6
NOTE:    Variable Name Change.  Older Adults (age 65 and over) -&amp;gt; Older_Adults__age_65_and_over_
NOTE:    Variable Name Change.  Racial and/or Ethnic Minority -&amp;gt; Racial_and_or_Ethnic_Minority
NOTE:    Variable Name Change.  Hispanic/Latino Ethnicity -&amp;gt; Hispanic_Latino_Ethnicity
NOTE:    Variable Name Change.  Black/African American -&amp;gt; Black_African_American
NOTE:    Variable Name Change.  American Indian/Alaska Native -&amp;gt; American_Indian_Alaska_Native
NOTE:    Variable Name Change.  Native Hawaiian / Other Pacific -&amp;gt; Native_Hawaiian___Other_Pacific
NOTE:    Variable Name Change.  More than one race -&amp;gt; More_than_one_race
NOTE:    Variable Name Change.  Best Served in another language -&amp;gt; Best_Served_in_another_language
877    run;

NOTE: The import data set has 1362 observations and 15 variables.
NOTE: There were 1362 observations read from the data set IN.'2018  AGE AND RACE-ETHNICITY'n.
NOTE: The data set WORK.TEST has 1362 observations and 15 variables.
NOTE: DATA statement used (Total process time):
      real time           0.22 seconds
      cpu time            0.23 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 18:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896315#M354164</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-28T18:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading ZIP File With SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896324#M354165</link>
      <description>&lt;P&gt;Thank you but would you mind doing it from SAS studio in Viya instead of off your c drive.&amp;nbsp; I think it may the whole cloud thing that has me confused.&amp;nbsp; I never have problems like this in 9.4.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 19:20:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/896324#M354165</guid>
      <dc:creator>telligent</dc:creator>
      <dc:date>2023-09-28T19:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading ZIP File With SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/981327#M379075</link>
      <description>Hi, Yabwon. It seems I just meet the situation you said. How did you solve it? By create a temp directory whose path contains no non-ascii character?</description>
      <pubDate>Mon, 29 Dec 2025 05:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/981327#M379075</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2025-12-29T05:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading ZIP File With SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/981334#M379077</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270406"&gt;@whymath&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are running&amp;nbsp;SAS 9.4M8 or&amp;nbsp;SAS 9.4M9 you shouldn't have that problem, I did test on both and Polish letters were not a problem:&lt;/P&gt;
&lt;P&gt;M9 on Windows:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yabwon_0-1766993329066.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112446i8BF9509443B16395/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yabwon_0-1766993329066.png" alt="yabwon_0-1766993329066.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;M8 on Linux:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yabwon_1-1766993371209.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112447iCE5881698CE62CAF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yabwon_1-1766993371209.png" alt="yabwon_1-1766993371209.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are running on SAS 9.4M7 or earlier changing the path is the simplest approach.&lt;/P&gt;
&lt;P&gt;I'd personally add something like a line or two to inform the user that non acsii characters are in the path:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  x = pathname('f1','f');
  put x=;

  str = kcompress(x,,'pdfs');
  put str=;

  if str NE " " then put "INFO: Dear User, there may be non ASCII characters in the path.";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yabwon_2-1766993761890.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112448i1242B80B9F0810F4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yabwon_2-1766993761890.png" alt="yabwon_2-1766993761890.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2025 07:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-ZIP-File-With-SAS/m-p/981334#M379077</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-12-29T07:37:10Z</dc:date>
    </item>
  </channel>
</rss>

