<?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: Access data online especially with .exe file that needs compressing. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Access-data-online-especially-with-exe-file-that-needs/m-p/427383#M105381</link>
    <description>&lt;P&gt;The syntax for a filename to reference an FTP site is&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="xis-keyword"&gt;FILENAME &lt;/SPAN&gt; &lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;&lt;A title="Description of syntax: fileref" href="http://127.0.0.1:60926/help/lestmtsref.hlp/p0v0ijxl1k6d4bn16cshtic7u4i3.htm#n0yoid4kj156aon1mbep3iu4g1ah" target="_blank"&gt;fileref&lt;/A&gt;&lt;/SPAN&gt; &lt;SPAN class="xis-argRequired"&gt;&lt;A title="Description of syntax: FTP" href="http://127.0.0.1:60926/help/lestmtsref.hlp/p0v0ijxl1k6d4bn16cshtic7u4i3.htm#p0f0kar7ha42win1ugxm7eed671j" target="_blank"&gt;FTP&lt;/A&gt;&lt;/SPAN&gt; '&lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;&lt;A title="Description of syntax: 'external-file'" href="http://127.0.0.1:60926/help/lestmtsref.hlp/p0v0ijxl1k6d4bn16cshtic7u4i3.htm#n1w6x5pdegyk1sn1qjnd8icx54gm" target="_blank"&gt;external-file&lt;/A&gt;&lt;/SPAN&gt;' &lt;SPAN class="xis-argOptional"&gt;&amp;lt;&lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;&lt;A title="Description of syntax: ftp-options" href="http://127.0.0.1:60926/help/lestmtsref.hlp/p0v0ijxl1k6d4bn16cshtic7u4i3.htm#p03zu0uw9e5wkxn1rz1zckqfa0hm" target="_blank"&gt;ftp-options&lt;/A&gt;&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but all that generates is a link to the file. You would then have to write code to use that filename. such as either a data step or proc import or similar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you have any code that worked before you attempted the macro? It sounds like you didn't. The approach to developing macro code, if needed, is to get one example working without any macro code involved and then identify the pieces that need to be modified.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would likely have a better shot starting&amp;nbsp;with&lt;/P&gt;
&lt;PRE&gt;%macro access (url = , fname = );
%let url =ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas ;

filename ed03 ftp "&amp;amp;url./&amp;amp;fname";

%mend access;&lt;/PRE&gt;
&lt;P&gt;When you get &lt;STRONG&gt;errors,&lt;/STRONG&gt; which I am pretty sure you did when attempting to use the filename, run macro code with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OPTIONS MPRINT SYMBOLGEN;&lt;/P&gt;
&lt;P&gt;before your macro call.&lt;/P&gt;
&lt;P&gt;Then copy and paste the result from the log into a code box opened with forum {I} menu.&lt;/P&gt;
&lt;P&gt;The mprint will show the code generated and symbolgen show the macro text resolutions.&lt;/P&gt;
&lt;P&gt;Your initial code has no ; at the end of either the %macro or %let statements so the Filename portion was PART of URL. And your macro&amp;nbsp;likely didn't even compile. I get:&lt;/P&gt;
&lt;PRE&gt;1149  %macro access (url = , fname = )
1150  %let url = "ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas"
ERROR: Expected semicolon not found.  The macro will not be compiled.
ERROR: A dummy macro will be compiled.
1151
1152  filename ed03 &amp;amp;url./&amp;amp;fname;
1153
1154  %mend access;
&lt;/PRE&gt;
&lt;P&gt;So of course any use of that macro will fail as in effect doing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%access (&amp;lt;parameters&amp;gt;) will be the equivalent of&amp;nbsp; a null statement.&lt;/P&gt;
&lt;P&gt;Which should have told you have syntax issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I doubt if you are going to get anything from an exe file. If those are supposed to be self extracting data files then just download them and is point to the file in your browser and do a save target as or what ever.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR learn the syntax for the FTP command. You could generate a X statement, or SYSTEM function&amp;nbsp;or %SYSEXEC statement&amp;nbsp;if you really must use SAS.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jan 2018 22:20:52 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-01-12T22:20:52Z</dc:date>
    <item>
      <title>Access data online especially with .exe file that needs compressing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Access-data-online-especially-with-exe-file-that-needs/m-p/427306#M105365</link>
      <description>&lt;P&gt;Hi all! i'm writing a macro function to retrieve data online from&amp;nbsp;online&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro access (url = , fname = )
%let url = "ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas"

filename ed03 &amp;amp;url./&amp;amp;fname;

%mend access;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 22:45:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Access-data-online-especially-with-exe-file-that-needs/m-p/427306#M105365</guid>
      <dc:creator>Viveme789</dc:creator>
      <dc:date>2018-01-12T22:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Access data online especially with .exe file that needs compressing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Access-data-online-especially-with-exe-file-that-needs/m-p/427356#M105379</link>
      <description>&lt;P&gt;Don't have time to dig into this, but if the data is also available in their open data portal you can extract it very easily.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://data.cdc.gov/browse?q=nchs&amp;amp;sortBy=relevance&amp;amp;anonymous=true" target="_blank"&gt;https://data.cdc.gov/browse?q=nchs&amp;amp;sortBy=relevance&amp;amp;anonymous=true&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's not, I would consider asking them to do so.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, do you have XCMD enabled? If so, this is possible but you still download the file and extract it, but SAS does it instead of you. I highly suspect whoever made the recommendation would expect something along the lines of the first approach, using the API and a live connection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 20:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Access-data-online-especially-with-exe-file-that-needs/m-p/427356#M105379</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-12T20:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Access data online especially with .exe file that needs compressing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Access-data-online-especially-with-exe-file-that-needs/m-p/427383#M105381</link>
      <description>&lt;P&gt;The syntax for a filename to reference an FTP site is&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="xis-keyword"&gt;FILENAME &lt;/SPAN&gt; &lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;&lt;A title="Description of syntax: fileref" href="http://127.0.0.1:60926/help/lestmtsref.hlp/p0v0ijxl1k6d4bn16cshtic7u4i3.htm#n0yoid4kj156aon1mbep3iu4g1ah" target="_blank"&gt;fileref&lt;/A&gt;&lt;/SPAN&gt; &lt;SPAN class="xis-argRequired"&gt;&lt;A title="Description of syntax: FTP" href="http://127.0.0.1:60926/help/lestmtsref.hlp/p0v0ijxl1k6d4bn16cshtic7u4i3.htm#p0f0kar7ha42win1ugxm7eed671j" target="_blank"&gt;FTP&lt;/A&gt;&lt;/SPAN&gt; '&lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;&lt;A title="Description of syntax: 'external-file'" href="http://127.0.0.1:60926/help/lestmtsref.hlp/p0v0ijxl1k6d4bn16cshtic7u4i3.htm#n1w6x5pdegyk1sn1qjnd8icx54gm" target="_blank"&gt;external-file&lt;/A&gt;&lt;/SPAN&gt;' &lt;SPAN class="xis-argOptional"&gt;&amp;lt;&lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;&lt;A title="Description of syntax: ftp-options" href="http://127.0.0.1:60926/help/lestmtsref.hlp/p0v0ijxl1k6d4bn16cshtic7u4i3.htm#p03zu0uw9e5wkxn1rz1zckqfa0hm" target="_blank"&gt;ftp-options&lt;/A&gt;&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but all that generates is a link to the file. You would then have to write code to use that filename. such as either a data step or proc import or similar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you have any code that worked before you attempted the macro? It sounds like you didn't. The approach to developing macro code, if needed, is to get one example working without any macro code involved and then identify the pieces that need to be modified.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would likely have a better shot starting&amp;nbsp;with&lt;/P&gt;
&lt;PRE&gt;%macro access (url = , fname = );
%let url =ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas ;

filename ed03 ftp "&amp;amp;url./&amp;amp;fname";

%mend access;&lt;/PRE&gt;
&lt;P&gt;When you get &lt;STRONG&gt;errors,&lt;/STRONG&gt; which I am pretty sure you did when attempting to use the filename, run macro code with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OPTIONS MPRINT SYMBOLGEN;&lt;/P&gt;
&lt;P&gt;before your macro call.&lt;/P&gt;
&lt;P&gt;Then copy and paste the result from the log into a code box opened with forum {I} menu.&lt;/P&gt;
&lt;P&gt;The mprint will show the code generated and symbolgen show the macro text resolutions.&lt;/P&gt;
&lt;P&gt;Your initial code has no ; at the end of either the %macro or %let statements so the Filename portion was PART of URL. And your macro&amp;nbsp;likely didn't even compile. I get:&lt;/P&gt;
&lt;PRE&gt;1149  %macro access (url = , fname = )
1150  %let url = "ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Dataset_Documentation/NAMCS/sas"
ERROR: Expected semicolon not found.  The macro will not be compiled.
ERROR: A dummy macro will be compiled.
1151
1152  filename ed03 &amp;amp;url./&amp;amp;fname;
1153
1154  %mend access;
&lt;/PRE&gt;
&lt;P&gt;So of course any use of that macro will fail as in effect doing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%access (&amp;lt;parameters&amp;gt;) will be the equivalent of&amp;nbsp; a null statement.&lt;/P&gt;
&lt;P&gt;Which should have told you have syntax issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I doubt if you are going to get anything from an exe file. If those are supposed to be self extracting data files then just download them and is point to the file in your browser and do a save target as or what ever.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR learn the syntax for the FTP command. You could generate a X statement, or SYSTEM function&amp;nbsp;or %SYSEXEC statement&amp;nbsp;if you really must use SAS.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 22:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Access-data-online-especially-with-exe-file-that-needs/m-p/427383#M105381</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-12T22:20:52Z</dc:date>
    </item>
  </channel>
</rss>

