Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Prompt

Status
Not open for further replies.

macroCharlie

Programmer
Jul 31, 2006
17
US
Is there a way in SAS to prompt for a file either with some kind of input box or by interfacing with the Windows API?
 
No idea, I've never done this.
If you're using SAS Enterprise Guide, you can set up prompts for macro variables in the process flow, then use the macro variable to build the file. Apparently one company (I heard at a recent SAS user group meeting) built a full customised graphical front end in Enterprise Guide, so that might be a path for you to investigate, apparently there are samples online on the SAS support site.

If you're using plain vanilla flavoured Base SAS, I think you've got no hope, at least,not within SAS itself.

There's also SAS/AF which might be worth invesitgating. I've never used it myself, and I've heard that it isn't that pleasant to work with, however it is basically there to put a graphical front end on SAS code.

One final alternative is to write a script program outside of SAS to gather this information before SAS even runs, then call your SAS program passing the gathered info as SYSPARMs. Languages like Python are apparently quite good for this sort of thing. You could also write the program in VB if you have it (or VBA maybe...), have this program write the filename to a text file, then call the script to run the SAS program...
If you're in an area with other types of programmer, this might be something that is worth discussing with them as they may be able to come up with something quite neat and elegant.

 
I have done this using a sas AF screen. If I have some time later today I can show you how. What the AF code does is save the filepath in a predefined SAS macro var.
Klaz
 
Thanks guys, I appreciate the input. I have both SAS 9.1 and Enterprise guide 3.0 and I believe all the extra add-ins for SAS.
 
SAS/EG has recently been updated to (I believe) 4.1, apparently it's really worth upgrading if you can persuade the powers-that-be.
If you're happy to work in SAS/EG, and arn't going to upgrade to 4.1, then the way to do it is create a query on a table (it's a pain, but in 3.0, the only way to get a parameter is to do a query, 4.1 lets you just set up parameter requests independantly). In the query, from memory, there's a parameters tab, you select that and then set up a request to get the filename you want. This is saved to a macro variable, which remains active for your whole SAS/EG session, and doesn't need to be used in the query you've created. It's a bit ugly but there you go.

If Klaz can help you with AF, that might be the way to go, to check if you have it submit this code
Code:
proc setinit;
run;
That'll list all your licensed SAS components (not necessarily what is installed, just what you are licensed for).

I think with 9,1, if you're using the metadata repository and Integration Technologies, there are other avenues to persue, for instance, you can set up a web page with some Java script which will allow the user to enter the desired parameters and submit the code without even needing SAS installed on their machine... Personally I've never used this stuff, but I've seen it proved in simple form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top