Desktop productivity for business analysts and programmers

Use a prompt for each line of a data set

Reply
Contributor
Posts: 40

Use a prompt for each line of a data set

Hi everyone,

I have a little (in fact, it's big) problem.

Here's a table :

prompt.jpg

I'd like to find a way, with a prompt, to "manually" fill the FLAG variable.

Basically, I'd like, for each line, to be asked via a prompt to choose if I put "1" or "0" for FLAG variable.

It must be manual (i.e. the user must decide manually on each line). I know I can modify directly the set and write 1 or 0, but to be honest, my boss insists for it to be via a prompt.

Is it possible ?

Thanks a lot

Super User
Super User
Posts: 7,682

Re: Use a prompt for each line of a data set

I don't use EG, so there maybe a solution.  In my opinion though data entry, which is what we are talking about, is on real failing with SAS.  There is AF/SCL to build forms but its really clunky.  Table entry is painful when doing more than one cell.  I would suspect this is why most people would use Excel (though it pains me to say it), set a Data Validation on that column in Excel so only 0 or 1 can be entered, maybe protect all other cells.  Then ask them to fill that in and return it to you for importing.

Contributor
Posts: 40

Re: Use a prompt for each line of a data set

Thank you RW9,

I thought about something similar (much less well-said than the way you did ahah) but I gonna be honest, my boss is really stubborn, and he wants it in EG only.

So you're telling me there is probably no way to do that ?

Super User
Super User
Posts: 7,682

Re: Use a prompt for each line of a data set

Well, I don't use EG so don't know it that well - others con comment on that.  The only other thing I can think of from a Base SAS point of view is window statements:

SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

http://www2.sas.com/proceedings/sugi27/p192-27.pdf

Sorry, I can't be more helpful than that.

SAS Super FREQ
Posts: 8,814

Re: Use a prompt for each line of a data set

Hi,

  But, %WINDOW statements may not work with EG, since all the EG-generated code is submitted to SAS on the server in batch mode. I thought that %WINDOW required interactive mode.

cynthia

Respected Advisor
Posts: 3,156

Re: Use a prompt for each line of a data set

Ok, I am an EG user. But first let me ask you, what is the bigger picture here? what is the purpose of doing it? If you have business rules, then apply it using SAS code; if it is purely arbitrary, then I don't see the difference between a random (0,1) assignment, which can also be done using direct code? If what you want is to let uses to see the data first before choosing a prompt, then I can't envision anything conventional.

Prompts, by its nature, are macro variables, which are settled before SAS code touches data, meaning in most of cases, they are used to set the conditions or redirect the code execution, not for inputing data. Please share more context so we can help you with your little/big problem as well as your boss Smiley Happy.

Haikuo

Contributor
Posts: 40

Re: Use a prompt for each line of a data set

Yeah that's right !

In fact I got that data set prior in my study. Later we receive a list of "contracts" for which we need to put provisions (sorry my english is bad). But the problem is, I have no key to match the two lines since the amounts differ so we have to do that "manually".

But yeah that's what I told my boss (that it was impossible) so now I am sure !

Thanks

Super User
Posts: 3,233

Re: Use a prompt for each line of a data set

If you were using "traditional" SAS there would be many options for data entry: %WINDOW, WINDOW, FSEDIT, FSVIEW, SAS/AF and SCL.

With EG all of those options are not possible because EG runs SAS in batch mode. Instead you have Process Flow prompts which are for controlling your EG jobs, not for data entry, You can use the EG table viewer in update mode to change data in a dataset but as already described it is designed more as a data viewer not for data entry.

You could build an EG custom task to do what you want but you would have to learn .NET and write many lines of .NET code to do what is really a very simple task - See SAS Dummy posts.

Excel isn't a bad option and at least it doesn't involve extra coding Smiley Wink. You can use it with the SAS Add-in to directly read or update SAS datasets.

Super Contributor
Posts: 307

Re: Use a prompt for each line of a data set

A simple workaround might be to set the flags in Excel (you can set Data Validation in Excel to only accept 0 or 1 as a precaution), import the workbook into your EG project and merge with your dataset to pick up the flag.

Ask a Question
Discussion stats
  • 8 replies
  • 445 views
  • 0 likes
  • 6 in conversation