我是proc iml的新手。所以……我不能声明和创建一个variable.In的代码行,声明显示为红色。如果我运行它,它就像“语句无效或使用顺序不正确”
谢谢你的帮助
proc iml;
declare DataObject dobj;
dobj = DataObject.CreateFromFile("Hurricanes");
dobj.Sort( "latitude" );发布于 2015-01-31 02:11:27
这是IML Studio语法,而不是PROC IML语法。IML Studio使用IMLPlus,它基本上是IML的面向对象版本。有关详细信息,请参阅this documentation page。
发布于 2015-01-31 02:11:37
如果想通过代码将数据集读入IML矩阵,通常的方法是:
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中找到。
编辑以回答扩展问题您可以使用create和append语句将数据从IML导出到数据集。然后使用其他过程执行直方图的绘图proc univariate或proc sgplot。
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 SAS、STAT和IML。
https://stackoverflow.com/questions/28241662
复制相似问题