首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SAS PROC iml无法声明

SAS PROC iml无法声明
EN

Stack Overflow用户
提问于 2015-01-31 01:43:23
回答 2查看 300关注 0票数 1

我是proc iml的新手。所以……我不能声明和创建一个variable.In的代码行,声明显示为红色。如果我运行它,它就像“语句无效或使用顺序不正确”

谢谢你的帮助

代码语言:javascript
复制
    proc iml;
declare DataObject dobj;
   dobj = DataObject.CreateFromFile("Hurricanes");
   dobj.Sort( "latitude" );
EN

回答 2

Stack Overflow用户

发布于 2015-01-31 02:11:27

这是IML Studio语法,而不是PROC IML语法。IML Studio使用IMLPlus,它基本上是IML的面向对象版本。有关详细信息,请参阅this documentation page

票数 2
EN

Stack Overflow用户

发布于 2015-01-31 02:11:37

如果想通过代码将数据集读入IML矩阵,通常的方法是:

代码语言:javascript
复制
proc iml;
    use sashelp.class; /* Open the dataset for reading */
    read all var _num_ into A; /* Put all the rows and all numeric columns into a matrix called A*/
    close sashelp.class; /* Close the dataset */
    /* Your IML statements here */
    print A;
quit;

我以前从未见过declare或dataobject语法,所以也许其他人可以解释一下。我认为它可能特定于SAS/IML Studio,而不是SAS/IML。编辑请参阅Joe's answer以获得解释。

有关IML代码的很好的参考资料可以在here中找到。有关read语句的更多详细信息(如何指定要读取的变量和行)可以在here中找到。

编辑以回答扩展问题您可以使用createappend语句将数据从IML导出到数据集。然后使用其他过程执行直方图的绘图proc univariateproc sgplot

代码语言:javascript
复制
proc iml;
    /* Read in your Data */
    use sashelp.cars;
    read all var _num_ into A; 
    close sashelp.cars;
    /* Your IML statements here */
    B = A;
    /* Write out your data */
    create temp from B;
    append from B;
quit;
/* Plot a histogram of the first two columns */
proc sgplot data = temp;
    histogram col1 / binstart = 0 binwidth = 10000;
    histogram col2 / binstart = 0 binwidth = 10000 transparency= 0.5;
run;

在查看文档时,您应该避免使用IML Studio用户指南,因为您没有访问该产品的权限。相反,尝试使用Base SASSTATIML

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28241662

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档