You must have been on to something. When I restarted SAS overnight, it just works now. I've spent 3 days trying as many combinations of quotes as I can think of, and today it just works (using the syntax in the original post). I hate it, lol. Thanks everyone for your help!
... View more
I have experimented with filename, x, %sysexec, call system. I've had the most luck with filename in terms of even getting error messages back. When I run the above syntax with an x command, it doesn't appear to do anything at all: there is no output saved as the desired file location and the command prompt doesn't even flicker. If that feels like something easier to fix, I'd love to hear any suggestions!
... View more
That interpreted the outfile path as a single quote as part of the file type of the json (json'), returning an error of "The specified path is invalid" and not populating anything in the file. Thanks for the suggestion!
... View more
I have a curl command that works in the command prompt that I need to get working in SAS 9.2. This is all translated from proc HTTP in 9.4 because some users at my company are still using the old version. The command that works in the command prompt (with abc123 substituted in critical positions): C:\Users\dc2\Downloads\curl.exe --location --request POST "https://example.com" -H "Authorization:Basic abc123==" -H "Content-Type:application/x-www-form-urlencoded" -H "Cookie:abc123=abc123" --data-urlencode "grant_type=refresh_token" --data-urlencode "refresh_token=abc123" > "C:\token.json" In SAS it looks like: data test;
CURLText = 'C:\Users\dc2\Downloads\curl.exe --location --request POST "https://example.com" -H "Authorization:Basic abc123==" -H "Content-Type:application/x-www-form-urlencoded" -H "Cookie:abc123=abc123" --data-urlencode "grant_type=refresh_token" --data-urlencode "refresh_token=abc123" > "C:\token.json"';
call symput ('CURLText', CURLText);
run;
filename req pipe %sysfunc(quote(&CURLText));
data _null_;
infile req missover lrecl= 32000;
input ;
file Response;
put _infile_;
run; Right now the error being stored in the local file is: Illegal character 'ᅠ' in header name. That error message goes away (and is replaced with an invalid request error) if I remove the colons from the header text. I would appreciate any help getting this to work! Once I have it working in long form, I'll tackle storing some of the relevant bits in macro variables and referencing them within the filename statement. Thanks!
... View more