avoid "Getting started with SAS" window when opening second SAS session - sas

How can the popup window ("getting started with sas") be prevented from displaying when opening a second SAS session (ie when a 'work' profile is used that does not contain your normal settings) ???
running
proc options internal; run;
reveals the TUTORIALDLG option, but I do not know the syntax to set this option at 'invocation' - (presumbably in the .CFG file..)

Just add the line
-NOTUTORIALDLG
to your config file or if you use the command line to start sas you can add the line to the startup command. If you need to find the location of the config file your session is using, submit this command:
proc options option=config;run;

Related

Executing a batch file using CFEXECUTE

I tried to run test.bat file using cfexecute. It shows timeout error after loding for sometime. The output file is blank. But when i double click the test.bat file it works fine. My code is this,
<cfexecute name="C:\Windows\System32\cmd.exe" arguments="/C C:\ColdFusion2018\cfusion\wwwroot\test.bat" timeout="60" outputfile="C:\ColdFusion2018\cfusion\wwwroot\log_output1.txt"></cfexecute>
We recommend using CFX_EXEC (Windows) instead of the built-in CFExecute. When running BAT files, we've encountered many cases where we needed to run it under a separate Windows account that had privileges different than the CF Service. CFX_EXEC enabled us to specify the specific account whereas CFExecute doesn't have the option at all. We also use CFX_EXEC for performing IP/DNS look-ups as it's a lot faster than Java, honors TTL and doesn't cache the lookup results "forever".
If you want to run test.bat using cfexecute, test.bat should be the value of the name attribute, not the arguments attribute.
<cfexecute name="C:\ColdFusion2018\cfusion\wwwroot\test.bat"
timeout="60"
arguments ="whatever applies"
outputfile="C:\ColdFusion2018\cfusion\wwwroot\log_output1.txt">
</cfexecute>
Thanks for your response,
The batch file successfully executed after suppressing the 'Press any key to continue..'(pause) in the command line. It makes the cfexecute loading till timeout. That was the issue here.

Finding PID responsible for "ERROR: A lock is not available for"

On UNIX systems, if a file lock is held, the error message includes a PID, eg:
ERROR: A lock is not available for XXX.XXXX.
ERROR: Lock held by process 4653302.
For windows, the guilty process is not provided. Is there a way I can find out who locked the table? I cannot log onto the machine, however the server does have XCMD enabled.
FWIW, the FILELOCKWAIT option is not helpful here (it's a long running lock).
EDIT: I am not an administrator, and I cannot download third party tools
wmic provides almost anything you want about the goings on in Windows.
win32_process will tell you (if your account has the proper policy settings) all about who is running what. Find the SASers and call em up ?
Example: Proc IMPORT can't read a pipe, so save the wmic output to a file first.
%let wmic_cmd = wmic path win32_process where "description like '%nrstr(%%sas.exe%%)'";
filename whosas pipe
"%superq(wmic_cmd) get /format:csv | findstr /r /v ""^$"" > c:\temp\wmic_whosas.txt"
;
data _null_;
infile whosas;
input;
run;
proc import dbms=csv datafile="c:\temp\wmic_whosas.txt" replace out=whosas;
run;
Should get you 47 pieces of info about each SAS process.
If you don't have permissions, IT will have to grant them, or get involved with you so often they eventually do :)

sas error: hpspit was unable to open the rules file for output

I am getting the below error when i am running 'proc hpsplit' in sas to create a decision tree.
sas error: hpspit was unable to open the rules file for output
My code is -
proc hpsplit data=sashelp.hmeq maxdepth=7 maxbranch=2;
target BAD;
input DELINQ DEROG JOB NINQ REASON / level=nom;
input CLAGE CLNO DEBTINC LOAN MORTDUE VALUE YOJ / level=int;
criterion entropy;
prune misc / N <= 6;
partition fraction(validate=0.2);
rules file='hpsplhme2-rules.txt';
score out=scored2;
run;
But if I change the statement 'rules file' declaration to the below -
rules file="%sysfunc(pathname(work))/rule.txt";
It runs fine in this case but then i am unable to view the rule.txt file.
Please suggest a way i can view the file or any other way i can proceed.
rules file='hpsplhme2-rules.txt'; will not necessarily write to work; it depends on what your default directory is in the current session. It's usually not WORK in my experience. If you're running SAS in DM mode it's whatever is in the bottom right of the window (for my installation the default is my User directory, i.e. C:\Users\myusername). But it can be anywhere, just depends on where your admin set it up to be, and if you executed any cd commands in the code.
The answer here is to fully qualify your path name. If you're running this on a server, make sure that path is a path you can write to from the server (not "c:\something" probably).
It could be as simple as
options noxwait noxsync xmin;
%sysexec
start
"Preview output"
"%sysfunc(pathname(WORK))\temp.txt"
;
If simple does not work the solution depends on your SAS client and the SAS host security policies.

Trace32 Write directory location to file

So I finally decided to bite the bullet and rewrite my company's terrible Trace32 scripts. I'm trying to use a data file to save the pertinent information between runs so we can just run a Redo script to repeat any action without having to navigate a mess of dialog boxes and select our workspace files after every power cycle. In order to do this, I will need to save the user defined variables from the previous run (including file locations) to file so I have them in the next run. For reference, here is a part of my menu script.
; File: Do.cmm
GLOBAL &WORKSPACE
GLOBAL &FILETOLOAD
GLOBAL &TARGETSELVAL
&WORKSPACE="//tsclient\Z\Product_trunk_MS" ; Not the ideal solution
PRINT "Workspace is &WORKSPACE"
DIALOG
(
HEADER "Do one of the following"
POS 0. 0. 23.
COMMAND.PREVIOUS: CHOOSEBOX "Repeat Last Command" ""
POS 24. 0. 23.
COMMAND.WORKSPACE: CHOOSEBOX "Change Workspace Location" ""
POS 0. 3. 25.
TEXT "Connect To an R7 Proc:"
POS 0. 4. 6.
COMMAND.IP0: CHOOSEBOX "IP0" ""
POS 8. 4. 7.
COMMAND.IP1: CHOOSEBOX "IP1" ""
; And a lot more of the same...
POS 17. 16. 15.
DEFBUTTON "OK" "continue"
)
DIALOG.SET COMMAND.PREVIOUS
STOP
IF DIALOG.BOOLEAN(COMMAND.IP0)
(
&TARGETSELVAL=0x00030000
&FILETOLOAD="&WORKSPACE\CPUs\IP0\build\output\IP0.axf"
)
IF DIALOG.BOOLEAN(COMMAND.IP1)
(
&TARGETSELVAL=0x0003001
&FILETOLOAD=&WORKSPACE\CPUs\IP1\build\output\IP1.axf
)
... And so on
The problem with this is that I have to edit the script every time I change workspaces. I want to be able to set this in the script above by selecting COMMAND.PREVIOUS and then selecting my new workspace root with the Windows selection dialog. I don't have a working implementation for that function, but I want it to look something like this:
IF DIALOG.BOOLEAN(COMMAND.WORKSPACE)
(
PRINT "Select the new root directory that you would like to work out of."
OPEN #1 workspace.dat /Create
&WORKSPACE= C/*/ ; I don't know how to do this here.
WRITE #1 &WORKSPACE
CLOSE #1
ENDDO
)
Obviously, Data.load.binary "*.bin" is able to load a file to memory, but I don't need the file loaded yet, I just want the path. I did find that symbol.SOURCEPATH.SETBASEDIR c:\* will open a dialog box, but I am still having trouble getting at that information.
Additional Info
I have read through a lot of this and this while trying to find a solution. If there is a built in path variable that I should be using (like the aforementioned SOURCEPATH.SETBASEDIR, I wouldn't mind doing that instead. This is my first day writing Trace32 scripts, so I apologize in advance for my naivete. If it matters, I am using Trace32 Powerview for ARM Release Feb 2017 SP2 (32 bit) (So, the latest)
TRACE32 has the concept of a working directory. The command ChDir can be used to change the current directory:
ChDir <path>
The current working directory can be retrieved with the PRACTICE function OS.PWD():
&WORKSPACE=OS.PWD()
The script example above could be extended like this:
IF DIALOG.BOOLEAN(COMMAND.WORKSPACE)
(
PRIVATE &old_directory
&old_directory=OS.PWD() // Save current directory
ChDir * // Open directory selection dialog
&WORKSPACE=OS.PWD() // Update working directory
OPEN #1 workspace.dat /Create
WRITE #1 &WORKSPACE
CLOSE #1
ChDir &old_directory // Restore previous directory selection
)
I ended up finding a solution to my problem that was a little different than xasc's, so I thought I'd share it.
IF DIALOG.BOOLEAN(COMMAND.WORKSPACE)
(
PRINT "Select the new root directory that you would like to work out of."
DIALOG.DIR *
ENTRY %LINE &WORKSPACE
OPEN #1 workspace.dat /Create
WRITE #1 "&WORKSPACE"
CLOSE #1
)
This was a little cleaner for my purposes because it didn't require me to change the working directory.
DIALOG seems to be the interface I was looking for, with the ability to open files, directories, and more and save them into variables.

When using zeus in zsh cursor position shifts after the the termination of zeus command

Sometimes there is a strange issue with terminal cursor in zsh when zeus command was terminated.
The position of cursor shifts and each line of the output in the console has extra indentation, e.g.
services GET /services(.:format) services#index
payments GET /payments(.:format) payments#index
orders_verify POST /orders_verify(.:format) orders_verify#index
orders GET /orders(.:format) orders#index
diets GET /diets(.:format) diets#index
The only way to fix that is to open a new terminal window/tab
Staircasing is unrelated to locale. Full-screen programs manipulate the terminal-mode settings to let them read single characters from the screen as well as send special characters (such as carriage return and line-feed) to the screen without having the terminal driver "translate" them.
The quick fix — run this command:
reset
(you may have to press controlJ after typing "reset" to enter this properly)
Further reading:
tset, reset - terminal initialization
Make sure you have set LOCALE environment vars to UTF-8 in your .zshrc file
Open .zshrc
vim ~/.zshrc
Add these lines
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Close the file (Shift-ZZ) and reload it in the current session (or open a new terminal window/tab)
. ~/.zshrc