%include 来自 github url 的 .sas 文件

%include .sas file from github url

我正在尝试直接从 github url 运行 一个 SAS 文件(其中包含一个 %macro)。我发现 this post on blogs.sas.com 似乎给了我解决方案。不幸的是,我无法让它工作。

我要运行的.sas文件已存储here on github


到目前为止,我从 blogs.sas post 中收集和修改的是:

filename _inbox "%sysfunc(getoption(work))/Macro H2_Piepho.sas";
proc http method="get" url="https://github.com/SchmidtPaul/HeritabilityScripts/blob/master/SAS/MACRO%20H2_Piepho.sas" 
out=_inbox;
run;
%Include _inbox;
filename _inbox clear;

但是它给我各种错误:

8418  %Include _inbox;
8425 +<!DOCTYPE html>
      -
      180
WARNING: Apparent symbolic reference AMP not resolved.
WARNING: Apparent symbolic reference AMP not resolved.
WARNING: Apparent symbolic reference LT not resolved.
WARNING: Apparent symbolic reference GT not resolved.
WARNING: Apparent symbolic reference LT not resolved.
WARNING: Apparent symbolic reference GT not resolved.
WARNING: Apparent symbolic reference AMP not resolved.
WARNING: The quoted string currently being processed has become more than 262 characters long.
          You might have unbalanced quotation marks.
WARNING: The quoted string currently being processed has become more than 262 characters long.
          You might have unbalanced quotation marks.
ERROR: The token currently being processed is in an incomplete state. You might have an
       unbalanced single quoted string or a token exceeding the maximum length of 65535
       characters.
9661 +        <li><a
9661!+href="/SchmidtPaul/HeritabilityScripts/blame/7a18272000de0cfede86ae70a012ef581e95be3d/SAS
9661!+/MACRO%20H2_Piepho.sas" class="dropdown-item js-update-url-with-hash"
                                                                          ------
                                                                          49
9661!+id="js-view-git-blame">View git blame</a></li>
ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS
             release.  Inserting white space between a quoted string and the succeeding
             identifier is recommended.

9662 +          <li><a href="/SchmidtPaul/HeritabilityScripts/issues/new" class="dropdown-item"

------

49
9662!+ id="js-new-issue">Open new issue</a></li>
9671 +  <button type="button" data-facebox="#jump-to-line" data-facebox-class="linejump"
                                                         ----------------------
---------------
----------------------------------
                                                         49                            49
49
9671!+data-hotkey="l" class="d-none">Jump to Line</button>
WARNING: Apparent symbolic reference HELLIP not resolved.
WARNING: Apparent symbolic reference COPY not resolved.

NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS
             release.  Inserting white space between a quoted string and the succeeding
             identifier is recommended.

在此先感谢您的帮助!

我发现了问题。我需要使用 SAS 文件的 RAW link。

您可以在没有 proc http 的情况下使用 filename 语句的 url access method 来执行此操作,例如:

filename bizarro url 
  "https://raw.githubusercontent.com/allanbowe/BizarroBall/master/bizarroball.sas";
%inc bizarro;