Prompting for SAS ODBC connection password when running in batch mode

时间秒杀一切 提交于 2019-12-24 03:45:17

问题


For various reasons I prefer to run my SAS programs in batch mode as much a possible. And for security reasons I'd prefer to have SAS prompt me for a password whenever making and ODBC connection to a Teredata warehouse. Can I have both of these things at once?

The following code works fine when run from SAS interactively, but won't create a prompt when run in batch.

proc sql;
    connect to odbc (prompt);
quit;

Anyone know of a way make this work? (Also, I'm looking for a solution specifically using the connect statement; SAS/ACCESS libname methods of reaching the Teradata aren't available to me.)


回答1:


I'm not sure that it's possible to have a batch program prompt you. However, you could solve the problem by making the password (or any part of the connection string or the whole string) a parameter you pass to SAS when you run the batch program, using SYSPARM.

Then you can type the password in the command line when you execute the program. You could easily do something like include a "%1" parameter in your normal "run SAS batch" program, or write a custom one for this use case.

If you like to run things by right-click menu run, you could solve it by writing a VB Script or a Powershell script (Windows), or a similar script in Unix, that opens a prompt window (via the OS) to get the parameter, then runs the program in batch (and then add that to the right-click menu).



来源:https://stackoverflow.com/questions/30514039/prompting-for-sas-odbc-connection-password-when-running-in-batch-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!