SAS数据集描述与SSH连接

时间:2019-10-10 08:29:13

标签: python sas jupyter-notebook saspy

我正在尝试使用python(使用saspy)在SAS中工作。我刚刚使用SSH连接到远程计算机,还可以。另外,我找到了我需要的表,而且一切似乎都很好。当我尝试获取数据集的head()或对其进行描述时,就会出现问题。代码和错误如下。 我认为配置文件中包含的输出格式或选项有问题(我只提到了'options' : ["-fullstimer "])。

sas = saspy.SASsession(cfgname='ssh')
dataset = sas.sasdata('tablename','libname')
dataset.head()

内部代码执行失败:错误22-322:语法错误,预期以下情况之一:;,ANTIALIAS,ANTIALIASMAX,BORDER,DISCRETEMAX,GROUPMAX,

1 个答案:

答案 0 :(得分:0)

恰好注意到了这一点。我必须记得在这里搜索才能找到东西。只要有机会,您就可以轻松地提出问题:https://github.com/sassoftware/saspy/issues 那么我可以更轻松地帮助您弄清楚发生了什么。

首先,您可以显示实际的代码和输出吗? Aslo在运行时提交SASsession对象和SASdata对象:

>>> sas = saspy.SASsession(cfgname='ssh')
SAS Connection established. Subprocess id is 4777

No encoding value provided. Will try to determine the correct encoding.
Setting encoding to latin_1 based upon the SAS session encoding value of latin1.
>>> sas
Access Method         = SSH
SAS Config name       = ssh
SAS Config file       = /opt/tom/github/saspy/saspy/sascfg_personal.py
WORK Path             = /sastmp/SAS_workB62300004C67_tom64-4/
SAS Version           = 9.04.01M3D06242015
SASPy Version         = 3.1.8
Teach me SAS          = False
Batch                 = False
Results               = Pandas
SAS Session Encoding  = latin1
Python Encoding value = latin_1
SAS process Pid value = 19559


>>> dataset = sas.sasdata('cars','sashelp')
>>> dataset
Libref  = sashelp
Table   = cars
Dsopts  = {}
Results = Pandas

>>> dataset.head()
    Make           Model   Type Origin DriveTrain   MSRP  Invoice  EngineSize  Cylinders  Horsepower  MPG_City  MPG_Highway  Weight  Wheelbase  Length
0  Acura             MDX    SUV   Asia        All  36945    33337         3.5          6         265        17           23    4451        106     189
1  Acura  RSX Type S 2dr  Sedan   Asia      Front  23820    21761         2.0          4         200        24           31    2778        101     172
2  Acura         TSX 4dr  Sedan   Asia      Front  26990    24647         2.4          4         200        22           29    3230        105     183
3  Acura          TL 4dr  Sedan   Asia      Front  33195    30299         3.2          6         270        20           28    3575        108     186
4  Acura      3.5 RL 4dr  Sedan   Asia      Front  43755    39014         3.5          6         225        18           24    3880        115     197
>>>

谢谢! 汤姆

顺便说一句,我也必须搜索我们的社区站点以查找内容。将问题发布给Saspy是获得帮助的最佳方法,FWIW。