统计211

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 4193|回复: 0
打印 上一主题 下一主题

SAS 9.2帮助很好很强大

[复制链接]
跳转到指定楼层
1
发表于 2011-7-27 19:58:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

一直觉得SAS的帮助做的很棒,想不到9.2考虑得更加完善,居然提供了一个Learning to Use SAS 这个帮助,很完善的例子,把SAS的每个模块都讲了,非常多,并且有详细的例子,例子看起来也特别简单易懂,如下图:


大家把例子全部过一遍,基本上就把SAS得功能全部走一遍了,很好,如下一个调用外部DLL函数的例子:

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: EXDLL1                                              */
/*   TITLE: External DLL Example 1 : Calling Functions within  +*/
/*          External DLLs from the DATA Step                    */
/* PRODUCT: SAS                                                 */
/*  SYSTEM: Windows                                             */
/*    KEYS: MODULE                                              */
/*   PROCS:                                                     */
/*    DATA:                                                     */
/*     REF:                                                     */
/*    MISC:                                                     */
/*    DESC: Demonstrates how to use the SAS System's MODULE     */
/*          functions/call routines to utilize both API and     */
/*          user-written functions located within Dynamic Link  */
/*          Libraries (DLLs).  In this example, the Windows API */
/*          function "MessageBoxA" is being called to display   */
/*          a dialog box with message text and 2 push buttons.  */
/****************************************************************/

/* Assign the MODULE routine specific fileref "SASCBTBL".       */
/* This fileref points to an attribute table definition table   */
/* used to describe the parameters and responses for each       */
/* function, the name of the DLL they are located in, and their */
/* architecture.  There must be an entry in this table for each */
/* function called by the MODULE routine.  In this example we   */
/* are creating a temporary work file utilizing the CATALOG     */
/* access method (new to 6.11).                                 */

FILENAME SASCBTBL CATALOG "work.temp.attrfile.source";

/* This DATA step dynamically creates an attribute table to     */
/* define the MessageBoxA API function used in the example      */
/* code below.  NOTE: Using an incorrect attribute definition   */
/* could abnormally terminate your SAS session or, even worse,  */
/* halt your operating system.  CAUTION IS ADVISED!!            */

DATA _NULL_;
    FILE SASCBTBL;

    PUT "ROUTINE MessageBoxA";
    PUT "    MINARG=4";
    PUT "    MAXARG=4";
    PUT "    STACKPOP=CALLED";
    PUT "    MODULE=USER32";
    PUT "    RETURNS=LONG;";
    PUT "  ARG 1 NUM  BYVALUE FORMAT=PIB4.;";
    PUT "  ARG 2 CHAR         FORMAT=$CSTR200.;";
    PUT "  ARG 3 CHAR         FORMAT=$CSTR200.;";
    PUT "  ARG 4 NUM  BYVALUE FORMAT=PIB4.;";
RUN;

/*--------------------------------------------------------------*/
/* The following SAS macro variables are defined to simplify    */
/* the specification of the parameters to the MessageBoxA       */
/* function.                                                    */
/*--------------------------------------------------------------*/
/*   Buttons or Button Groups                                   */
%LET MBOK     = 0;     /* [OK] - Default                        */
%LET MBOKCAN  = 1;     /* [OK]  [Cancel]                        */
%LET MBABREIG = 2;     /* [Abort]  [Retry]  [Ignore]            */
%LET MBYENOCA = 3;     /* [Yes]  [No]  [Cancel]                 */
%LET MBYESNO  = 4;     /* [Yes]  [No]                           */
%LET MBRETCAN = 5;     /* [Retry]  [Cancel]                     */
/*   Icons                                                      */
%LET MBNOICON = 0;     /* No icon - Default                     */
%LET MBISTOP = 16;     /* A 'STOP' icon                         */
%LET MBIQUEST = 32;    /* A question mark icon                  */
%LET MBIEXCLA = 48;    /* An exclamation mark icon              */
%LET MBIINFOR = 64;    /* An information 'i' icon               */
/*   Default Button                                             */
%LET MBDEFB1  = 0;     /* 1st button is the default - Default   */
%LET MBDEFB2  = 256;   /* 2nd button is the default             */
%LET MBDEFB3  = 512;   /* 3rd button is the default             */
/*   Response Codes  (NOTE: These indicate the button selected) */
%LET MBIDOK   = 1;     /* [OK] was selected                     */
%LET MBIDCAN  = 2;     /* [Cancel] was selected                 */
%LET MBIDABO  = 3;     /* [Abort] was selected                  */
%LET MBIDRET  = 4;     /* [Retry] was selected                  */
%LET MBIDIGN  = 5;     /* [Ignore] was selected                 */
%LET MBIDYES  = 6;     /* [Yes] was selected                    */
%LET MBIDNO   = 7;     /* [No] was selected                     */
%LET MBIDERR  = 0;     /* An API error occurred (check params)  */
/*--------------------------------------------------------------*/
/* MessageBoxA PARAMETERS AND RETURN CODES:                     */
/* Usage:                                                       */
/*   Response = MessageBoxA(0, Message, Caption, Style)         */
/*                                                              */
/* Response - The value returned from the function indicating   */
/*            what action the user took (see Response Codes     */
/*            above).                                           */
/* Message  - The text to appear in the body of the dialog.     */
/* Caption  - Text to be used in for the dialog's caption.      */
/* Style    - A number indicating features required in the      */
/*            dialog box (icons and buttons).  The number is    */
/*            derived by adding one value from each of the      */
/*            first 3 sections above (Buttons or Button Groups, */
/*            Icons and Default Button) together.               */
/*--------------------------------------------------------------*/

/* Use the MODULE interface to call the MessageBoxA function.   */

DATA _NULL_;
     response = MODULEN("MessageBoxA", 0,
   "This is the text that appears as the dialog message.",
   "THIS IS THE CAPTION TEXT",
   &MBOKCAN + &MBIINFOR + &MBDEFB1);

     SELECT (response);
  WHEN (&MBIDOK)
      PUT "The [OK] button was selected.";
  WHEN (&MBIDCAN)
      PUT "The [CANCEL] button was selected.";
  WHEN (&MBIDERR)
      PUT "An ERROR condition occurred." /
   "Check the MessageBoxA parameters.";
  OTHERWISE
      PUT "An unexpected response code of" response
   " was returned.";
     END;
RUN;



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖 支持支持 反对反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


免责声明|关于我们|小黑屋|联系我们|赞助我们|统计211 ( 闽ICP备09019626号  

GMT+8, 2025-4-18 04:49 , Processed in 0.078165 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表