Help using Base SAS procedures

Using %WINDOW

Reply
Frequent Contributor
Posts: 80

Using %WINDOW

Hi, I have used %WINDOW and %DISPLAY in programs before and have not had this problem. I am running PC SAS 9.2. This is my problem: when it opens up you have Explorer on the left, the log window on top and the Program Editor underneath. So when I click submit, the new window displays, but only part of it. Part of it is still behind the Program Editor and I have to actually click on it to see the whole window and make it active.
I don't have this problem in another program that I run, that has the same code. It opens up on top of the log and program editor and waits for me to enter data.

This is the code that I am using and trying to get to work:

%window month color=gray
#5 @3 "Date of Access: &sysday, &sysdate.."
#10 @23 "DAILY CHECKIN SHEET" ATTR=underline
#15 @20 "Select this Month and Year"
#17 @25 "to Process:"
@46 mmm 3 protect=yes
@50 yr 2 protect=yes
#19 @25 "or Choose another"
#20 @25 "Month and Year:"
@46 mmm 3 attr=underline @50 yr 2 attr=underline
#23 @20 "Press" @26 "ENTER" attr=underline
@32 "when ready to Continue.";

%display month;

Has anyone had this problem. I don't see anything different than my other program.

Thanks for any suggestions.
Nancy
Valued Guide
Posts: 2,175

Re: Using %WINDOW

works OK for me. The display window comes to the front.
Could the problem be in the other window?
Frequent Contributor
Posts: 80

Re: Using %WINDOW

Your right - if I just copy that code into the Program Editor window by itself and submit, it brings up a window on top of the log and program editor window. But if I run my program that has other macro modules in it that are called, it does not bring it up on top of the program editor, only over the log window. I can't figure this out.

I have broken this program into five macros, each that get called separately after a check to make sure the previous macro terminated successfully. This %WINDOW part is at the beginning of the program before the macros start to get called. I have tried to change the options statement 'noxwait' back and forth, thinking that was it. But with no luck.

I am still stumped! Smiley Sad
Nancy
Valued Guide
Posts: 2,175

Re: Using %WINDOW

perhaps it would be enough to close pgm ( dm 'PGM off' ; ) Message was edited by: Peter.C
Frequent Contributor
Posts: 80

Re: Using %WINDOW

It doesn't seem to matter if I put in
dm 'listing off';
or dm 'pgm off';
or dm 'pgm off' continue;

Nothing changes. Does it for you if you run that last program?

But also, my question is this where would I put this statement inside the program? At the top or before I execute the macro that does the check?

Thanks
Valued Guide
Posts: 2,175

Re: Using %WINDOW

try instead
dm 'icon all' ;
this iconizes all windows just before you open the macro window. Then that is the only open window.
Frequent Contributor
Posts: 80

Re: Using %WINDOW

OK, I have messed with this enough. This is what I have found. In my old version of the program I had a line of code as the very first line that was this: dm log 'clear' log;
which I did not include in the example I put on the web.

This is an example of the problem program:

dm log 'clear;' log;
%macro show;
data _null_;
%window month color=gray
COLUMNS= 80 ROWS= 40
#5 @3 "Date of Access: &sysday, &sysdate.."
#17 @25 "to Process:"
@46 mmm 3 protect=yes
@50 yr 2 protect=yes
#19 @25 "or Choose another"
#20 @25 "Month and Year:"
@46 mmm 3 attr=underline @50 yr 2 attr=underline;
%display MONTH;
STOP;

run;

dm MONTH 'zoom' MONTH continue;
%mend show;

%show;


This is what was causing all the problems. So when the %WINDOW part executed it ran correctly but the 'active window' would stay as the last active window; in this case the LOG window. So in order for me to have the %WINDOW display on top as the active window I took out this line of code.

Peter - I tried the 'icon all' and this seems to work, meaning it displays the window on top. But it does not make it active, so the user still would have to click on the window to make it active and put the cursor in the position I am expecting it to be.

Thanks for all your help.
Nancy
Valued Guide
Posts: 2,175

Re: Using %WINDOW

and finally .... ?
dm 'clear log;' ;

this worked for me
Frequent Contributor
Posts: 80

Re: Using %WINDOW

Peter,

So you are saying that if you copy my last example, but change the first DM statement to the following ( dm 'clear log;' ; ) that the %WINDOW window displayed on top as the active window and with the cursor in the position that it was suppose to be in?

It did not work for me. I opened SAS 9.2 copied the small example I had in my reply, then changed the top DM statement to be what you showed. Ran it but the PGM Editor window is the active window on top of the display window with the cursor sitting where it was when I click the running man.

Maybe something else is going on with my system setup.

I give up! Smiley Indifferent
Thanks,
Nancy
Valued Guide
Posts: 2,175

Re: Using %WINDOW

I cannot explain.
Your macro window is on the top of my display whether I use enhanced editor or the old pgm editor
I run sas9.2.2 ts2m3 in win-vista
Frequent Contributor
Posts: 80

Re: Using %WINDOW

If this program is tried it does what I am talking about.

/***********************************************************

PROGRAM NAME: New_Daily.sas
DESCRIPTION: Daily Spreadsheet on PC
DATE: June 2010

************************************************************/


dm 'clear log; clear output';

options mprint symbolgen; * mlogic;
/*options xwait xsync; */

%global filnme mypath newdir newdrive mydir mmmyy mth year4 ;

%let filnme = %sysget(SAS_EXECFILENAME);
%let xpath = %sysget(SAS_EXECFILEPATH);
%let mypath = %substr(&xpath,1,%length(&xpath)-%length(&filnme));
%let locvalue = &sysdate9;
%let yr = %substr(&locvalue,8,2);
%let yr4 = %substr(&locvalue,6,4);
%let mmm = %lowcase(%substr(&locvalue,3,3));
%put &mmm&yr4;


%macro START;
/**************************************************************/
/* This displays a window; that allows the user to select */
/* the month and year wanted for the Daily Checkin Report. */
/**************************************************************/

%window month color=gray

#5 @3 "Date of Access: &sysday, &sysdate.."
#10 @23 "DAILY CHECKIN SHEET" ATTR=underline
#15 @20 "Select this Month and Year"
#17 @25 "to Process:"
@46 mmm 3 protect=yes
@50 yr 2 protect=yes
#19 @25 "or Choose another"
#20 @25 "Month and Year:"
@46 mmm 3 attr=underline @50 yr 2 attr=underline
#23 @20 "Press" @26 "ENTER" attr=underline
@32 "when ready to Continue.";

%display month;


%mend START;
%put Month to Process is: &mmm;
%put Year to Process is: &yr;


data _null_;
call symput('curmth',"&mmm");
run;

/*options xwait xsync; */

%macro noexectest(condition=, /* condition assessed */
msg=); /* message to display in log if condition met */

%global noexecmacroend;

%if %unquote(&condition) %then %do; %* check user condition, if true;
%let noexecmacroend=; %* uncomment mend statement;
%put %sysfunc(repeat(*,55)); %* display message;
%put %upcase(&msg);
%put %sysfunc(repeat(*,55));
%unquote(%nrstr(%macro noexecdummySmiley Wink); %* and start dummy macro;

%let a=%nrstr(%mend);
%end; %* [This dummy macro includes all statements until mend];
%* [These statements will not be run];
%else
%let noexecmacroend=* ; %* else keep mend stmt commented;

%mend;


%START; * Display the %Window;


%noexectest( condition=%str(&syserr ne 0),
msg= RC=&syserr - Start of Program Errored!);
Ask a Question
Discussion stats
  • 10 replies
  • 302 views
  • 0 likes
  • 2 in conversation