<?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: Learning macro: can't read zip file in SAS studio in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Learning-macro-can-t-read-zip-file-in-SAS-studio/m-p/637082#M21421</link>
    <description>&lt;P&gt;There are two obvious issues with the code as posted.&lt;/P&gt;
&lt;P&gt;One is a simple SAS programming mistake.&amp;nbsp; Macro references (&amp;amp; and %) are not evaluated inside of strings that are using single quote characters on the outside. Use double quote characters instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"&amp;amp;Path/names.zip"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Second is that the virtual machine cannot see your file system.&amp;nbsp; It can only see the folder you shared (and any folder and files under it).&amp;nbsp; So if you mapped the folder on your MAC named&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/Users/me/my_SAS_Stuff&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to the unix path on the virtual machine named:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/folders/myfolders&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then in your SAS code ALL of the paths that you use must start with:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/folders/myfolders&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you need change the value you assign to the PATH macro variable to reflect this.&amp;nbsp; It cannot start with c: like in your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are not sure where SAS sees the files you can ask it by looking at the path in the properties of the file in the FILES and FOLDERS view.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Apr 2020 21:15:17 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-04-02T21:15:17Z</dc:date>
    <item>
      <title>Learning macro: can't read zip file in SAS studio</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Learning-macro-can-t-read-zip-file-in-SAS-studio/m-p/637052#M21419</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I just started learning SAS a few months ago and am currently learning macro. I have a zip file and I made sure the file is in my virtual machine file (since I am running university edition on Mac). The macro program ran with no problem yet it could not read any of the data in the file. Hope some could help me out thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Options nocenter nodate nonumber nosymbolgen;
%Let Path = c:/folders/myshortcuts/myFolder/;
Libname MYFOLDER '/folders/myfolders';
%macro readraw (first=, last=);
Filename ZIPFILE SASZIPAM '&amp;amp;Path/names.zip';
   %do year=&amp;amp;first %to &amp;amp;last;
	 DATA MYFOLDER.DSN&amp;amp;Year;
 	    INFILE ZIPFILE(yob&amp;amp;year..txt) DLM=',';
  	    INPUT name $ gender $ number;
	 RUN;
	 title "Listing from Data Set (Newborns' Names) for &amp;amp;Year";
	    proc print data=MYFOLDER.DSN&amp;amp;Year(obs=5) noobs; 
		format number comma7.;
        run;
    %end ;
%mend readraw;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Apr 2020 20:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Learning-macro-can-t-read-zip-file-in-SAS-studio/m-p/637052#M21419</guid>
      <dc:creator>cheungmonica</dc:creator>
      <dc:date>2020-04-02T20:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Learning macro: can't read zip file in SAS studio</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Learning-macro-can-t-read-zip-file-in-SAS-studio/m-p/637082#M21421</link>
      <description>&lt;P&gt;There are two obvious issues with the code as posted.&lt;/P&gt;
&lt;P&gt;One is a simple SAS programming mistake.&amp;nbsp; Macro references (&amp;amp; and %) are not evaluated inside of strings that are using single quote characters on the outside. Use double quote characters instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"&amp;amp;Path/names.zip"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Second is that the virtual machine cannot see your file system.&amp;nbsp; It can only see the folder you shared (and any folder and files under it).&amp;nbsp; So if you mapped the folder on your MAC named&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/Users/me/my_SAS_Stuff&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to the unix path on the virtual machine named:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/folders/myfolders&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then in your SAS code ALL of the paths that you use must start with:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/folders/myfolders&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you need change the value you assign to the PATH macro variable to reflect this.&amp;nbsp; It cannot start with c: like in your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are not sure where SAS sees the files you can ask it by looking at the path in the properties of the file in the FILES and FOLDERS view.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 21:15:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Learning-macro-can-t-read-zip-file-in-SAS-studio/m-p/637082#M21421</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-02T21:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Learning macro: can't read zip file in SAS studio</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Learning-macro-can-t-read-zip-file-in-SAS-studio/m-p/637339#M21455</link>
      <description>&lt;P&gt;Thank you so much! This is my first time trying a macro code and your suggestions worked!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 19:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Learning-macro-can-t-read-zip-file-in-SAS-studio/m-p/637339#M21455</guid>
      <dc:creator>cheungmonica</dc:creator>
      <dc:date>2020-04-03T19:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Learning macro: can't read zip file in SAS studio</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Learning-macro-can-t-read-zip-file-in-SAS-studio/m-p/637358#M21457</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Options nocenter nodate nonumber nosymbolgen;
%Let Path =/folders/myfolders;
Libname mylib "&amp;amp;Path";
%macro readraw (first=, last=);
  Filename ZIPFILE SASZIPAM "&amp;amp;Path/names.zip";
   %do year=&amp;amp;first %to &amp;amp;last;
	 DATA mylib.DSN&amp;amp;Year;
 	    INFILE ZIPFILE(yob&amp;amp;year..txt) DLM=',';
  	    INPUT name $ gender $ number;
	 RUN;
	 title "Listing from Data Set (Newborns' Names) for &amp;amp;Year";
	    proc print data=mylib.DSN&amp;amp;Year(obs=5) noobs; 
		format number comma7.;
        run;
    %end ;
%mend readraw;
%readraw(first=2000, last=2005);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is my code using in SAS U.E. I put the names.zip in /folders/myfolders. But it still has a problem that SAS cannot find the .txt file. I don't know how to fix it.&lt;/P&gt;&lt;P&gt;Could you please figure out how I can correct it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 21:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Learning-macro-can-t-read-zip-file-in-SAS-studio/m-p/637358#M21457</guid>
      <dc:creator>Siwen</dc:creator>
      <dc:date>2020-04-03T21:02:44Z</dc:date>
    </item>
  </channel>
</rss>

