Hi,
I would like to be able to do something like this:
x 'p:^cd \sites\^spacechk.bat >c:\sites.txt';
Assuming the ^ character is a command separator. Not sure if it is possible in Windows, much less easy. Anyone done this before?
--Ben
You separate commands by & or &&, but each command has to correct.
Test it on your OS first and then use it in SAS.
You separate commands by & or &&, but each command has to correct.
Test it on your OS first and then use it in SAS.
Oh, now that's slick. Worked perfectly.
Thanks!!
--Ben
On a related note, is there a way to mask an embedded blank in an argument to a batch file? By default it will throw off the count of the # of arguments...
Thanks!
--Ben
Usually you use quotation marks? You can embded single quotes within double quotes or double quotes within single quotes as necessary.
Doesn't seem to work in passing arguments in a .bat file. Will Google it and see what I can find.
Thanks!
--Ben
You may have to show the content of the batch file.
That's certainly not a problem. I called it runsas.bat:
echo Initiating run for %3.sas
echo 1=%~1
echo 2=%~2
echo 3=%~3
pause
%1
cd %2
copy lock %3.lck
"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -sysin "%3.sas" -memsize max
del %3.lck
The first 4 lines are for debugging and will go away. The object was to run it from SAS with the X command. Argument 1 is the drive letter; argument 2 is the path to the SAS program to be run; argument 3 is the name of the SAS source file w/o a suffix.
The file 'lock' is a single character file used as a blocking semaphore. Or will be when I get this working.
Since the path can have embedded spaces in it, this has been causing me grief trying to get it right.
--Ben
While I wasn't able to find a solution to the original question, I found a way to get (mostly) the same thing done:
x " ""C:\Program Files\SASHome\SASFoundation\9.4\sas.exe"" -sysin ""&runpath\test1.sas"" -log ""&runpath\test1.log"" ";
also works nicely for kicking off an external SAS run. Coupling it with noxwait and noxsync then allows a controlling SAS sheduler to spawn off different SAS runs at will without getting held up waiting for each to complete. This was the final goal.
Thanks!
--Ben
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.