<?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 Getting API data into a SAS dataset format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Getting-API-data-into-a-SAS-dataset-format/m-p/392691#M277769</link>
    <description>&lt;P&gt;Looking for some help. This is my first attempt to pull data using an API. In the past I go out and download the U.S. Census American Community Survey files I need as CSV's and do a PROC IMPORT. I'd like to try and get only the few variables I need via their API.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code to get totals for all census tracts (1249) in my state:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;filename test "C:\Users\n00b\Desktop\API_Test\test.txt";&lt;BR /&gt;PROC HTTP&lt;BR /&gt; URL= "http://api.census.gov/data/2015/acs5?get=NAME,B01001_001E&amp;amp;for=tract:*&amp;amp;in=state:08&amp;amp;in=county:*"&lt;BR /&gt; method = 'GET'&lt;BR /&gt; out=test;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I pull it into a text file but it generates the following green text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: Apparent symbolic reference FOR not resolved.
WARNING: Apparent symbolic reference IN not resolved.
WARNING: Apparent symbolic reference IN not resolved.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm assuming because I have wildcards to get all the different tracts?&lt;/P&gt;&lt;P&gt;Also now that I have the API data, how do I get it into a SAS dataset format? Is there a way besides PROC IMPORT?&lt;/P&gt;&lt;P&gt;Can I ask for multiple variables from different tables on the same call or is it one request per line (e.g. Var 1&amp;nbsp;on Table A and Var 1&amp;nbsp;on Table B&amp;nbsp;in the same line of code)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry this is probably basic stuff but I'm getting stuck. Any help appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Sep 2017 21:56:33 GMT</pubDate>
    <dc:creator>BenWW85</dc:creator>
    <dc:date>2017-09-01T21:56:33Z</dc:date>
    <item>
      <title>Getting API data into a SAS dataset format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-API-data-into-a-SAS-dataset-format/m-p/392691#M277769</link>
      <description>&lt;P&gt;Looking for some help. This is my first attempt to pull data using an API. In the past I go out and download the U.S. Census American Community Survey files I need as CSV's and do a PROC IMPORT. I'd like to try and get only the few variables I need via their API.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code to get totals for all census tracts (1249) in my state:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;filename test "C:\Users\n00b\Desktop\API_Test\test.txt";&lt;BR /&gt;PROC HTTP&lt;BR /&gt; URL= "http://api.census.gov/data/2015/acs5?get=NAME,B01001_001E&amp;amp;for=tract:*&amp;amp;in=state:08&amp;amp;in=county:*"&lt;BR /&gt; method = 'GET'&lt;BR /&gt; out=test;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I pull it into a text file but it generates the following green text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: Apparent symbolic reference FOR not resolved.
WARNING: Apparent symbolic reference IN not resolved.
WARNING: Apparent symbolic reference IN not resolved.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm assuming because I have wildcards to get all the different tracts?&lt;/P&gt;&lt;P&gt;Also now that I have the API data, how do I get it into a SAS dataset format? Is there a way besides PROC IMPORT?&lt;/P&gt;&lt;P&gt;Can I ask for multiple variables from different tables on the same call or is it one request per line (e.g. Var 1&amp;nbsp;on Table A and Var 1&amp;nbsp;on Table B&amp;nbsp;in the same line of code)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry this is probably basic stuff but I'm getting stuck. Any help appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 21:56:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-API-data-into-a-SAS-dataset-format/m-p/392691#M277769</guid>
      <dc:creator>BenWW85</dc:creator>
      <dc:date>2017-09-01T21:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Getting API data into a SAS dataset format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-API-data-into-a-SAS-dataset-format/m-p/392696#M277770</link>
      <description>&lt;P&gt;The warning messages happen because SAS is interpreting the URL text &amp;amp;XXX as a reference to a macro variable you have not previously defined. Enclosing your URL string in single quotes rather that double quotes should remove the warnings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for reading in the text file, you could do that in a DATA step using an INFILE and an INPUT statement similar to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  infile test;
  input column1 $ column2 $ column3 $;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can change the INPUT statement to match the layout of your text file. Please supply details of the layout if you need further help.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 23:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-API-data-into-a-SAS-dataset-format/m-p/392696#M277770</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-09-01T23:13:23Z</dc:date>
    </item>
  </channel>
</rss>

