how to close a word session from sas without closing other active word session(s)

how to close a word session from sas without closing other active word session(s)

Post by Leslie Ki » Thu, 06 Jun 2002 06:39:59



I searched the archive and couldn't find how to close a WORD session
from SAS.  The FileExit() vb code will close off all active WORD
sessions.
   put '[FileExit()]';

The idea is to allow SAS programmers to trigger a WORD session, start
DDE data transfer, save and close that WORD session.  Often times
there is another WORD session open, and I want to leave that alone,
away from the SAS dde to WORD session.

Do you know what is the right vb code to archive this?  Thanks for
help.

   /******************************************************************/
   /* DDE needs these options turned off (Page 220 of SAS Companion)
*/
   /******************************************************************/
   options noxwait noxsync;  

   /*****************/
   /* Start up Word */
   /*****************/
   %* Try to open Application;
  options noxsync noxwait xmin;
  x start winword;

   /**********************************/
   /* Give it a few seconds to load, */
   /* otherwise the message:         */
   /* "Physical file does not exist" */
   /* shows up and the job bombs.    */
   /**********************************/
   data _null_;
      t = sleep(5);
   run;

   filename wordsys dde "winword|system";

   data _null_;
      file wordsys;

      /************************************/
      /* Insert the output (*.txt) file ***/
      /************************************/
      put "[InsertFile ""test.txt""]";

      put "[StartOfDocument]";

      /*********************************************************/
      /* The following 5 commands remove the page break that   */
      /* SAS puts at the very top of the file and inserts a    */
      /* blank line at the top of the 1st page. (Have not been */
      /* successful in simply removing the page break -- it    */
      /* pulls the 1st title off center)                       */
      /*********************************************************/
      put "[LineDown]";
      put "[InsertPara]";
      put "[StartOfDocument]";
      put "[EndOfLine]";
      put "[DeleteWord]";

      /**************************/
      /* Select entire document */
      /**************************/
      put '[EditSelectAll]';

      /*************************************/
      /* Apply SAS monospace font, 8 point */
      /*************************************/
      put '[Font "SAS Monospace"]';
      put '[FontSize 8]';

      /************************************************/
      /* Note: LineSpacing=160 translates into 8 pts. */
      /************************************************/
      put '[FormatParagraph .LineSpacingRule=4,.LineSpacing=160]';

      /***************************************************/
      /* Set page margins, paper size, orientation, etc. */
      /***************************************************/
      put '[FilePageSetup .Tab = "1", .PaperSize = "0", .TopMargin =
"1.5" +
   Chr$(34), .BottomMargin = ".75" + Chr$(34), .LeftMargin =
    "1" + Chr$(34), .RightMargin = ".75" + Chr$(34), .Gutter = "0" +
   Chr$(34)]';

      put '[FilePageSetup .PageWidth = "11" + Chr$(34), .PageHeight =
"8.5" +
   Chr$(34),.Orientation = 1]';

   put '[FilePageSetup .FirstPage = 0,.OtherPages = 0, .VertAlign = 0,
   .ApplyPropsTo = 4,.FacingPages = 0, .HeaderDistance = "0.5" +
    Chr$(34), .FooterDistance = "0.5" + Chr$(34)]';

   put '[FilePageSetup .SectionStart = 2, .OddAndEvenPages = 0,
   .DifferentFirstPage = 0,.Endnotes = 0, .LineNum=0, .StartingNum =
"",
     .FromText = "", .CountBy = "0", .NumMode = -1]';

      /************************************************/
      /* Embed the SAS Monospace font in the document */
      /************************************************/
      put '[ToolsOptionsSave .EmbedFonts=1]';

      put '[ViewHeader]';
      put '[Font "SAS Monospace"]';
      put '[FontSize 24]';
      put '[Insert "                                     DRAFT        
    " ]';
      put '[Insert "                                                  

       "]';
      put '[FontSize 8]';

      /************************/
      /* Save it as .DOC file */
      /************************/
      put "[FileSaveAs "test.doc"]";

      /**************/
      /* Close Word */
      /**************/
      put '[FileExit()]';
      *put '[close]'; * not working;
      *put '[quit]'; *not working;

   run;

 
 
 

how to close a word session from sas without closing other active word session(s)

Post by Matthew Ne » Thu, 06 Jun 2002 07:26:46


Hi Leslie,

Have you tried, PUT '[FileClose]';?

Matt

                    Leslie King

                    L.COM>               cc:
                    Sent by:             Subject:     how to close a word session from sas
                    "SAS(r)               without closing other active              word
                    Discussion"           session(s)

                    V.UGA.EDU>

                    04/06/02 02:39
                    PM
                    Please respond
                    to Leslie King

I searched the archive and couldn't find how to close a WORD session
from SAS.  The FileExit() vb code will close off all active WORD
sessions.
   put '[FileExit()]';

The idea is to allow SAS programmers to trigger a WORD session, start
DDE data transfer, save and close that WORD session.  Often times
there is another WORD session open, and I want to leave that alone,
away from the SAS dde to WORD session.

Do you know what is the right vb code to archive this?  Thanks for
help.

   /******************************************************************/
   /* DDE needs these options turned off (Page 220 of SAS Companion)
*/
   /******************************************************************/
   options noxwait noxsync;

   /*****************/
   /* Start up Word */
   /*****************/
   %* Try to open Application;
  options noxsync noxwait xmin;
  x start winword;

   /**********************************/
   /* Give it a few seconds to load, */
   /* otherwise the message:         */
   /* "Physical file does not exist" */
   /* shows up and the job bombs.    */
   /**********************************/
   data _null_;
      t = sleep(5);
   run;

   filename wordsys dde "winword|system";

   data _null_;
      file wordsys;

      /************************************/
      /* Insert the output (*.txt) file ***/
      /************************************/
      put "[InsertFile ""test.txt""]";

      put "[StartOfDocument]";

      /*********************************************************/
      /* The following 5 commands remove the page break that   */
      /* SAS puts at the very top of the file and inserts a    */
      /* blank line at the top of the 1st page. (Have not been */
      /* successful in simply removing the page break -- it    */
      /* pulls the 1st title off center)                       */
      /*********************************************************/
      put "[LineDown]";
      put "[InsertPara]";
      put "[StartOfDocument]";
      put "[EndOfLine]";
      put "[DeleteWord]";

      /**************************/
      /* Select entire document */
      /**************************/
      put '[EditSelectAll]';

      /*************************************/
      /* Apply SAS monospace font, 8 point */
      /*************************************/
      put '[Font "SAS Monospace"]';
      put '[FontSize 8]';

      /************************************************/
      /* Note: LineSpacing=160 translates into 8 pts. */
      /************************************************/
      put '[FormatParagraph .LineSpacingRule=4,.LineSpacing=160]';

      /***************************************************/
      /* Set page margins, paper size, orientation, etc. */
      /***************************************************/
      put '[FilePageSetup .Tab = "1", .PaperSize = "0", .TopMargin =
"1.5" +
   Chr$(34), .BottomMargin = ".75" + Chr$(34), .LeftMargin =
    "1" + Chr$(34), .RightMargin = ".75" + Chr$(34), .Gutter = "0" +
   Chr$(34)]';

      put '[FilePageSetup .PageWidth = "11" + Chr$(34), .PageHeight =
"8.5" +
   Chr$(34),.Orientation = 1]';

   put '[FilePageSetup .FirstPage = 0,.OtherPages = 0, .VertAlign = 0,
   .ApplyPropsTo = 4,.FacingPages = 0, .HeaderDistance = "0.5" +
    Chr$(34), .FooterDistance = "0.5" + Chr$(34)]';

   put '[FilePageSetup .SectionStart = 2, .OddAndEvenPages = 0,
   .DifferentFirstPage = 0,.Endnotes = 0, .LineNum=0, .StartingNum =
"",
     .FromText = "", .CountBy = "0", .NumMode = -1]';

      /************************************************/
      /* Embed the SAS Monospace font in the document */
      /************************************************/
      put '[ToolsOptionsSave .EmbedFonts=1]';

      put '[ViewHeader]';
      put '[Font "SAS Monospace"]';
      put '[FontSize 24]';
      put '[Insert "                                     DRAFT
    " ]';
      put '[Insert "

       "]';
      put '[FontSize 8]';

      /************************/
      /* Save it as .DOC file */
      /************************/
      put "[FileSaveAs "test.doc"]";

      /**************/
      /* Close Word */
      /**************/
      put '[FileExit()]';
      *put '[close]'; * not working;
      *put '[quit]'; *not working;

   run;

 
 
 

how to close a word session from sas without closing other active word session(s)

Post by Leslie Ki » Fri, 07 Jun 2002 01:16:38


Thanks.  This is exactly what I want.  

> Hi Leslie,

> Have you tried, PUT '[FileClose]';?

> Matt

>                     Leslie King

>                     L.COM>               cc:
>                     Sent by:             Subject:     how to close a word session from sas
>                     "SAS(r)               without closing other active              word
>                     Discussion"           session(s)

>                     V.UGA.EDU>

>                     04/06/02 02:39
>                     PM
>                     Please respond
>                     to Leslie King

> I searched the archive and couldn't find how to close a WORD session
> from SAS.  The FileExit() vb code will close off all active WORD
> sessions.
>    put '[FileExit()]';

> The idea is to allow SAS programmers to trigger a WORD session, start
> DDE data transfer, save and close that WORD session.  Often times
> there is another WORD session open, and I want to leave that alone,
> away from the SAS dde to WORD session.

> Do you know what is the right vb code to archive this?  Thanks for
> help.

>    /******************************************************************/
>    /* DDE needs these options turned off (Page 220 of SAS Companion)
> */
>    /******************************************************************/
>    options noxwait noxsync;

>    /*****************/
>    /* Start up Word */
>    /*****************/
>    %* Try to open Application;
>   options noxsync noxwait xmin;
>   x start winword;

>    /**********************************/
>    /* Give it a few seconds to load, */
>    /* otherwise the message:         */
>    /* "Physical file does not exist" */
>    /* shows up and the job bombs.    */
>    /**********************************/
>    data _null_;
>       t = sleep(5);
>    run;

>    filename wordsys dde "winword|system";

>    data _null_;
>       file wordsys;

>       /************************************/
>       /* Insert the output (*.txt) file ***/
>       /************************************/
>       put "[InsertFile ""test.txt""]";

>       put "[StartOfDocument]";

>       /*********************************************************/
>       /* The following 5 commands remove the page break that   */
>       /* SAS puts at the very top of the file and inserts a    */
>       /* blank line at the top of the 1st page. (Have not been */
>       /* successful in simply removing the page break -- it    */
>       /* pulls the 1st title off center)                       */
>       /*********************************************************/
>       put "[LineDown]";
>       put "[InsertPara]";
>       put "[StartOfDocument]";
>       put "[EndOfLine]";
>       put "[DeleteWord]";

>       /**************************/
>       /* Select entire document */
>       /**************************/
>       put '[EditSelectAll]';

>       /*************************************/
>       /* Apply SAS monospace font, 8 point */
>       /*************************************/
>       put '[Font "SAS Monospace"]';
>       put '[FontSize 8]';

>       /************************************************/
>       /* Note: LineSpacing=160 translates into 8 pts. */
>       /************************************************/
>       put '[FormatParagraph .LineSpacingRule=4,.LineSpacing=160]';

>       /***************************************************/
>       /* Set page margins, paper size, orientation, etc. */
>       /***************************************************/
>       put '[FilePageSetup .Tab = "1", .PaperSize = "0", .TopMargin =
> "1.5" +
>    Chr$(34), .BottomMargin = ".75" + Chr$(34), .LeftMargin =
>     "1" + Chr$(34), .RightMargin = ".75" + Chr$(34), .Gutter = "0" +
>    Chr$(34)]';

>       put '[FilePageSetup .PageWidth = "11" + Chr$(34), .PageHeight =
> "8.5" +
>    Chr$(34),.Orientation = 1]';

>    put '[FilePageSetup .FirstPage = 0,.OtherPages = 0, .VertAlign = 0,
>    .ApplyPropsTo = 4,.FacingPages = 0, .HeaderDistance = "0.5" +
>     Chr$(34), .FooterDistance = "0.5" + Chr$(34)]';

>    put '[FilePageSetup .SectionStart = 2, .OddAndEvenPages = 0,
>    .DifferentFirstPage = 0,.Endnotes = 0, .LineNum=0, .StartingNum =
> "",
>      .FromText = "", .CountBy = "0", .NumMode = -1]';

>       /************************************************/
>       /* Embed the SAS Monospace font in the document */
>       /************************************************/
>       put '[ToolsOptionsSave .EmbedFonts=1]';

>       put '[ViewHeader]';
>       put '[Font "SAS Monospace"]';
>       put '[FontSize 24]';
>       put '[Insert "                                     DRAFT
>     " ]';
>       put '[Insert "

>        "]';
>       put '[FontSize 8]';

>       /************************/
>       /* Save it as .DOC file */
>       /************************/
>       put "[FileSaveAs "test.doc"]";

>       /**************/
>       /* Close Word */
>       /**************/
>       put '[FileExit()]';
>       *put '[close]'; * not working;
>       *put '[quit]'; *not working;

>    run;

 
 
 

1. Accessing SAS Share with XMS (OS390) without a sas -session

Hi All.
Is it possibel to address a SAS Share server from rexx / tso on the host without starting a SAS session or even have a SAS session Started before?

Please let me know if there is a possibility to do so.

Sincerely

Raimund

--

Diese E-Mail enth?lt vertrauliche und/oder rechtlich geschtzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtmlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

2. Very basic Voodoo card question...

3. Acrobat 4.0 closes DDE conversation session if any plug-in is invoked

4. Web parts and .NET aspx applications...

5. Close Media Session?

6. DOS 5.0 partition table

7. telnet session and closes immediately

8. Electronic Organisers

9. Closing an Oracle ODBC-session from MS Access ?????

10. Close Session

11. solaris / cde lock closes session

12. Drawterm session close??

13. Delete entries in Symbol table without exiting the SAS session