<?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: Converting curl to SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794310#M254692</link>
    <description>&lt;P&gt;First, make sure you can get to the internet from your SAS session. &lt;A href="https://blogs.sas.com/content/sasdummy/2018/01/23/check-json-and-http/" target="_self"&gt;Run this test&lt;/A&gt;. You might need to specify a proxy host.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the SSL check, you might add this statement before the &lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;sslparms "sslreqcert"="allow";&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;The&lt;/SPAN&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n154smey890g2xn1l6wljfyjcemh.htm" target="_self" rel="nofollow noopener noreferrer"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SSLPARMS statement&amp;nbsp;&lt;/A&gt;&lt;SPAN&gt;can help specify behavior for verifying certificates.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Oh, and as far as getting a data set instead -- quickest way is PROC IMPORT after your step:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;proc import 
 datafile="path-to-csv-result.csv"
 out=work.result
 dbms=CSV;
run;&lt;/LI-CODE&gt;
&lt;P&gt;A DATA step is more flexible to read CSV, but requires you know something about its structure.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Feb 2022 17:58:55 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2022-02-03T17:58:55Z</dc:date>
    <item>
      <title>Converting curl to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794220#M254653</link>
      <description>&lt;P&gt;I´ve been trying to use SAS to import a database extracted through curl, but couldn´t figure how to pass the --data statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My curl command is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;curl --data "format=csv&amp;amp;includeColumnHeaders=1" --header "X-RJM-API-Key: &amp;lt;my-api-key&amp;gt;" &lt;A href="https://api.rjmetrics.com/0.1/figure/" target="_blank" rel="noopener"&gt;https://api.rjmetrics.com/0.1/figure/&lt;/A&gt;&amp;lt;my-table-id&amp;gt;/export --ssl-no-revoke&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I´ve tryied proc http method, but without success.&lt;BR /&gt;&lt;BR /&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:33:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794220#M254653</guid>
      <dc:creator>carloshmcaldas</dc:creator>
      <dc:date>2022-02-03T15:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting curl no SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794222#M254654</link>
      <description>Have you tried to save the output of the curl command to a file using the -o directive/flag, then using SAS to read in the saved csv file?&lt;BR /&gt;example: curl --data "format=csv&amp;amp;includeColumnHeaders=1" --header "X-RJM-API-Key: &amp;lt;my-api-key&amp;gt;" &lt;A href="https://api.rjmetrics.com/0.1/figure/" target="_blank"&gt;https://api.rjmetrics.com/0.1/figure/&lt;/A&gt;&amp;lt;my-table-id&amp;gt;/export --ssl-no-revoke -o somefilename.csv</description>
      <pubDate>Thu, 03 Feb 2022 14:41:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794222#M254654</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2022-02-03T14:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting curl to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794240#M254665</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;filename result "/path-to-new-csv.csv";
proc http
 url="https://api.rjmetrics.com/0.1/figure/&amp;lt;my-table-id&amp;gt;/export"
 in = "format=csv&amp;amp;includeColumnHeaders=1"
 out = result;
 
headers
 "X-RJM-API-Key" = "&amp;lt;my-api-key&amp;gt;";
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794240#M254665</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2022-02-03T15:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Converting curl to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794296#M254687</link>
      <description>&lt;BR /&gt;Tryed&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;filename result temp;&lt;BR /&gt;proc http&lt;BR /&gt;url="&lt;A href="https://api.rjmetrics.com/0.1/figure/11111/export" target="_blank"&gt;https://api.rjmetrics.com/0.1/figure/11111/export&lt;/A&gt;"&lt;BR /&gt;in = "format=csv"&lt;BR /&gt;in = "includeColumnHeaders=1"&lt;BR /&gt;out=result;&lt;BR /&gt;headers "X-RJM-API-Key" = "11111111";&lt;BR /&gt;debug level=3;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Log shows a 403 error:&lt;BR /&gt;&lt;BR /&gt;&amp;lt; HTTP/1.1 403 Forbidden&lt;BR /&gt;&amp;lt; Content-Type: text/html; charset=UTF-8&lt;BR /&gt;&amp;lt; Date: Thu, 03 Feb 2022 17:21:30 GMT&lt;BR /&gt;&amp;lt; Server: Apache&lt;BR /&gt;2 The SAS System 13:20 Thursday, February 3, 2022&lt;BR /&gt;&lt;BR /&gt;&amp;lt; Content-Length: 13&lt;BR /&gt;&amp;lt; Connection: keep-alive&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;On my curl command I had to use "--ssl-no-revoke"&lt;BR /&gt;&lt;BR /&gt;By the way, is there a way to make the output as a dataset, instead of a CSV?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks Chris!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Feb 2022 17:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794296#M254687</guid>
      <dc:creator>carloshmcaldas</dc:creator>
      <dc:date>2022-02-03T17:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Converting curl to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794310#M254692</link>
      <description>&lt;P&gt;First, make sure you can get to the internet from your SAS session. &lt;A href="https://blogs.sas.com/content/sasdummy/2018/01/23/check-json-and-http/" target="_self"&gt;Run this test&lt;/A&gt;. You might need to specify a proxy host.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the SSL check, you might add this statement before the &lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;sslparms "sslreqcert"="allow";&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;The&lt;/SPAN&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n154smey890g2xn1l6wljfyjcemh.htm" target="_self" rel="nofollow noopener noreferrer"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SSLPARMS statement&amp;nbsp;&lt;/A&gt;&lt;SPAN&gt;can help specify behavior for verifying certificates.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Oh, and as far as getting a data set instead -- quickest way is PROC IMPORT after your step:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;proc import 
 datafile="path-to-csv-result.csv"
 out=work.result
 dbms=CSV;
run;&lt;/LI-CODE&gt;
&lt;P&gt;A DATA step is more flexible to read CSV, but requires you know something about its structure.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 17:58:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794310#M254692</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2022-02-03T17:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Converting curl to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794374#M254717</link>
      <description>&lt;P&gt;I've tried sslreqcert and still dont works..&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 23:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794374#M254717</guid>
      <dc:creator>carloshmcaldas</dc:creator>
      <dc:date>2022-02-03T23:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Converting curl to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794391#M254723</link>
      <description>&lt;P&gt;What error are you getting? The same HTTP 403?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just noticed in the code you said you tried you had two IN= option specified. You need just one IN=, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;filename result temp;
proc http
url="https://api.rjmetrics.com/0.1/figure/11111/export"
in = "format=csv&amp;amp;includeColumnHeaders=1"
out=result;
headers "X-RJM-API-Key" = "11111111";
debug level=3;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And did you &lt;A href="https://blogs.sas.com/content/sasdummy/2018/01/23/check-json-and-http/" target="_self"&gt;test PROC HTTP in general&lt;/A&gt; as I suggested? Is that working?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 04:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-curl-to-SAS/m-p/794391#M254723</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2022-02-04T04:23:03Z</dc:date>
    </item>
  </channel>
</rss>

