08-18-2024
GreenCode
SAS Employee
Member since
06-23-2011
- 8 Posts
- 0 Likes Given
- 0 Solutions
- 2 Likes Received
-
Latest posts by GreenCode
Subject Views Posted 1333 08-15-2024 11:36 PM 3053 04-21-2023 02:04 AM 2463 04-14-2023 10:11 AM 3086 04-14-2023 09:55 AM 1271 07-27-2022 10:54 AM 3425 07-11-2022 05:31 AM 6864 05-15-2008 01:39 AM 1273 05-14-2008 11:22 PM -
Activity Feed for GreenCode
- Posted Re: PROC JIEBA 过程,在SAS调用JIEBA中文分词功能 on 欢迎来到SAS中文社区!. 08-15-2024 11:36 PM
- Posted Re: PROC JIEBA 过程,在SAS调用JIEBA中文分词功能 on 欢迎来到SAS中文社区!. 04-21-2023 02:04 AM
- Got a Like for Re: use java connect sas and run one spript.sas. 04-18-2023 10:09 PM
- Got a Like for Re: PROC JIEBA 过程,在SAS调用JIEBA中文分词功能. 04-18-2023 10:09 PM
- Posted Re: use java connect sas and run one spript.sas on 欢迎来到SAS中文社区!. 04-14-2023 10:11 AM
- Posted Re: PROC JIEBA 过程,在SAS调用JIEBA中文分词功能 on 欢迎来到SAS中文社区!. 04-14-2023 09:55 AM
- Posted sqlite libname 引擎 on 欢迎来到SAS中文社区!. 07-27-2022 10:54 AM
- Posted PROC JIEBA 过程,在SAS调用JIEBA中文分词功能 on 欢迎来到SAS中文社区!. 07-11-2022 05:31 AM
- Posted Re: clearing the cache in SAS on ODS and Base Reporting. 05-15-2008 01:39 AM
- Posted Re: import syntax on SAS Procedures. 05-14-2008 11:22 PM
-
My Liked Posts
Subject Likes Posted 1 04-14-2023 10:11 AM 1 04-14-2023 09:55 AM
04-14-2023
10:11 AM
1 Like
Java连接SAS服务器提交SAS代码运行例子:
import java.io.BufferedOutputStream; import java.io.FileOutputStream; import org.omg.CORBA.StringHolder; import com.sas.iom.SAS.IBinaryStream; import com.sas.iom.SAS.IFileService; import com.sas.iom.SAS.IFileref; import com.sas.iom.SAS.ILanguageService; import com.sas.iom.SAS.IWorkspace; import com.sas.iom.SAS.IWorkspaceHelper; import com.sas.iom.SAS.StreamOpenMode; import com.sas.iom.SASIOMDefs.OctetSeqHolder; import com.sas.services.connection.BridgeServer; import com.sas.services.connection.ConnectionFactoryConfiguration; import com.sas.services.connection.ConnectionFactoryInterface; import com.sas.services.connection.ConnectionFactoryManager; import com.sas.services.connection.ConnectionInterface; import com.sas.services.connection.ManualConnectionFactoryConfiguration; import com.sas.services.connection.Server; public class DownloadOutput { /** * @param args */ public static void main(String[] args) { try { String classID = Server.CLSID_SAS; String host = "t3207.na.sas.com"; int port = 8591; Server server = new BridgeServer(classID, host, port); // TODO Auto-generated method stub ConnectionFactoryConfiguration cxfConfig = new ManualConnectionFactoryConfiguration( server); ConnectionFactoryManager cxfManager = new ConnectionFactoryManager(); ConnectionFactoryInterface cxf = cxfManager.getFactory(cxfConfig); String user = "sasdemo"; String password = "Orion123"; ConnectionInterface cx = cxf.getConnection(user, password); org.omg.CORBA.Object obj = cx.getObject(); IWorkspace sasWorkspace = IWorkspaceHelper.narrow(obj); IFileService fileService = sasWorkspace.FileService(); StringHolder outstring = new StringHolder(); IFileref fileRef = fileService.AssignFileref("out", "TEMP", "", "", outstring); ILanguageService languageService = sasWorkspace.LanguageService(); String sasCode = "goptions reset=all gsfname=out gsfmode=replace dev=pdf; proc gchart data=sashelp.class;vbar age / discrete;run;quit;"; languageService.Submit(sasCode); IBinaryStream fileStream = fileRef .OpenBinaryStream(StreamOpenMode.StreamOpenModeForReading); BufferedOutputStream fos = new BufferedOutputStream( new FileOutputStream("c:\\temp\\test.pdf")); boolean readMore = true; OctetSeqHolder tempData = new OctetSeqHolder(); while (readMore) { fileStream.Read(1024, tempData); if (tempData.value.length == 0) { readMore = false; } else { fos.write(tempData.value); } } fileStream.Close(); fos.close(); cx.close(); } catch (Exception e) { e.printStackTrace(); } } }
... View more
04-14-2023
09:55 AM
1 Like
不好意思,好久没来这里。是的,是用SAS提供的编程接口工具SAS/TOOLKIT来写的调用jieba功能的一个自定义过程步,具体的实现可看完整的源代码 https://github.com/SASAnalyser/PROC-JIEBA 和SAS/TOOLKIT 帮助文档 https://support.sas.com/documentation/onlinedoc/toolkit/p245.pdf
... View more
07-27-2022
10:54 AM
sqlite libname 引擎,可以通过libname语句直接访问sqlite数据库,目前只有Windows 64位版本,下载地址: https://github.com/SASAnalyser/PROC-JIEBA/releases/download/1.0/libname-sqlite_win_x64.zip
安装方法:下载上面文件解压到 <SASHome>\SASFoundation\9.4\core\sasexe 下面就可以,因为是静太连接sqlite库所以不需要安装sqlite。
使用方法如下,如果sqlite数据库文件不存在,将会创建一个:
/* write to sqlite database */
libname mylib sqlite "C:/temp/sample.db";
data mylib.air;
set sashelp.air;
run;
/* read from sqlite database */
libname mylib sqlite "C:/temp/sample.db";
data air;
set mylib.air;
run;
已知限制:目前不支持bulkload,不支持在Base SAS里直接打开sqlite数据表和看表属性,不支持sqlite的BLOB类型
... View more
07-11-2022
05:31 AM
利用SAS Toolkit写的一个过程步,可以在SAS代码中调用JIEBA中文分词功能,源代码在 https://github.com/SASAnalyser/PROC-JIEBA,可以执行文件: https://github.com/SASAnalyser/PROC-JIEBA/releases
需要Windows 或者Linux 下安装有64位 SAS 9.4 (Unicode 支持),例子:
data indata; format inword $char200.; input inword; datalines; 小明硕士毕业于中国科学院计算所,后在日本京都大学深造 ; run;
proc jieba data=indata out=outdata maxword=32; dictpath "C:\SASToolkit\cjieba\dict"; var inword; instr "我是拖拉机学院手扶拖拉机专业的"; run;
对indata里var 指定的变量如果没var则对所有字符变量分词和 instr指定的句子分词。
结果保存在 out 数据集,如果不指定 out 数据集则结果打印在日志窗口。
... View more
05-15-2008
01:39 AM
You can try following statement to un-assign libname:
libname db_name clear;
... View more
05-14-2008
11:22 PM
Hi,
You can refer to following link:
http://support.sas.com/documentation/onlinedoc/91pdf/sasdoc_913/base_proc_8977.pdf
... View more