BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DOBBINHO
Obsidian | Level 7

Hi All,

 

I would like to know if there is a way to dynamically increase or decrease the no. of input texts in a window statement dynamically. There are many scenarios in which we would have varying no. of inputs. For example, the task of access providing would be very cumbersome if we had to do so one at a time. But in the window statement we have a way to get as many inputs as possible (maximum being 10).

I wanted to be able to enter a number first and then subsequently get a window displaying the same no. of input lines, i.e; If I enter 5, I should get a window that has 5 inputs. Kindly advice.

 

Thanks and regards,

Prithviraj

1 ACCEPTED SOLUTION

Accepted Solutions
DOBBINHO
Obsidian | Level 7

Hi All,

 

I have found the solution to my problem.

The sample program is as follows:

 

%window studyn
#5 @5 "Enter number of studies"
   @40 numstud 3 attr = underline
       required = yes;
%display studyn;

%macro study_in;
%do i=1 %to &numstud;
#%eval(2+&i) "Enter Study &i:" @20 study&i 8
attr = underline required = yes
%end;
%mend study_in;

%window studyn
%study_in;
;
%display studyn;

 

What I have done here is I have created a primary window where I need to input a number of studies that I would like to input. Once I enter a specific number, a second window should open displaying exactly the same number of inputs as the number I entered in the first window. I utilized an external macro in the %Window statement in order to achieve the same.

 

Thanks and regards,

Prithviraj

View solution in original post

8 REPLIES 8
Cynthia_sas
SAS Super FREQ
Hi:
Can you elaborate on what you mean, with more detail. Are you asking about %WINDOW? Are you using SAS/AF? SAS/EG? Stored process input prompts? SAS/IntrNet? It is not entirely clear what application you're using, or whether you're using SAS or an HTML form to collect input.

Cynthia
DOBBINHO
Obsidian | Level 7

Yes Cynthia,

 

I am indeed talking about the window and %window statements.

In a normal window or % window statement, we would need to specify a number of input text lines in the program. I would like to be able to vary the same dynamically, i.e; display a primary window where I can input a number, and then subsequently open another window which displays the same no. of input lines as the number we input in the primary window.

 

Please advice.

 

Thanks and regards,

Prithviraj

ballardw
Super User

It would likely help to show what kind of Window statement you are currently using.

Also indicate what needs to change and what kind of range it needs to handle.

 

Since the number of items displayed can affect size there are going to be a number of factors involved.

Perhaps a %window may help.

 

Cynthia_sas
SAS Super FREQ
Hi:
I have not used %WINDOW since my mainframe days, which were long ago, in a galaxy far, far away.

So I am not the best person to answer this. %WINDOW does not work in EG, for example, and has mostly been overtaken in EG by the use of project prompts.

My recommendation would be for you to open a track with Tech Support since %WINDOW is older technology, unless you find someone else who remembers how to specify the options for the window. As I remember, the %WINDOW statement could specify the rows and columns, size-wise, but I honestly don't remember the particulars.

Cynthia
DOBBINHO
Obsidian | Level 7

Hi Cynthia,

 

You mentioned that the %Window statement was an old methodology. What do you mean?

Are there better alternatives to this method? I am using a Unix environment to run SAS 9.1.

Kindly advice.

 

Thanks and regards,

Prithviraj

 

DOBBINHO
Obsidian | Level 7

Hi All,

 

I have found the solution to my problem.

The sample program is as follows:

 

%window studyn
#5 @5 "Enter number of studies"
   @40 numstud 3 attr = underline
       required = yes;
%display studyn;

%macro study_in;
%do i=1 %to &numstud;
#%eval(2+&i) "Enter Study &i:" @20 study&i 8
attr = underline required = yes
%end;
%mend study_in;

%window studyn
%study_in;
;
%display studyn;

 

What I have done here is I have created a primary window where I need to input a number of studies that I would like to input. Once I enter a specific number, a second window should open displaying exactly the same number of inputs as the number I entered in the first window. I utilized an external macro in the %Window statement in order to achieve the same.

 

Thanks and regards,

Prithviraj

Cynthia_sas
SAS Super FREQ
Hi:

%WINDOW works within an interactive SAS session to put some text and prompts on the screen in the session and then wait for the user to input responses and then the responses could be used in code behind the scenes. This relied heavily on understanding SAS Macro Facility and macro processing and also, needed to be an interactive SAS session. %WINDOW would not work in batch mode.

Since it is not clear to me what you are doing or what you want to do, it is hard to suggest better alternatives to %WINDOW. SAS 9.1 is rather old, too. I'd expect you to be running SAS 9.3 or 9.4.

At any rate, if you search on lexjansen.com, you'll see that most of the papers about %WINDOW are older -- here's one from SUGI 25: http://www2.sas.com/proceedings/sugi25/25/cc/25p076.pdf, which was in 2002 or 2003. Or this one from SUGI 27 http://www2.sas.com/proceedings/sugi27/p192-27.pdf or this one from SUGI 24: http://www2.sas.com/proceedings/sugi24/Coders/p091-24.pdf. As you can see, all of the papers on the usage of %WINDOW are over 10-15 years old.

If I were using SAS on Unix, I'd see whether it was possible to connect EG to the Unix session and try using Project prompts to ask for input from the users.

Or, find out whether SAS/AF is available and develop an AF application.


More than a few alternatives (in no particular order):
1) SAS/AF (but then your AF application would have to be installed on every desktop that was going to use the application)
2) SAS Studio tasks
3) SAS/IntrNet using an HTML form for input
4) EG connecting to SAS on your Unix server
5) SAS Office Analytics using SAS Add-in for Microsoft Office to connect to SAS on Unix server
6) SAS Enterprise BI and SAS Add-in for Microsoft Office to connect to SAS on Unix server or using Web Report Studio or the Portal to prompt for input and then run code
7) SAS Stored Process running in client application using prompts to impact program running on Unix server.

It seems like you have some program or process to run and you are collecting inputs prior to running. But without an understanding of the process and the program, it is difficult to make suggestions.

Cynthia
DOBBINHO
Obsidian | Level 7

Hi Cynthia,

Its true I have a program process for which I am taking prior inputs. However I would not be able to provide information on the same.

However my objective is simple:

(I)Collect a number (in this case it would be the number of input lines required) in the primary window

(II)Display the same number or required input lines in a second successive window

 

Thanks and regards,

Prithviraj

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 1143 views
  • 0 likes
  • 3 in conversation