SAS EG and the TaskList Pipe

Accepted Solution Solved
Reply
Contributor
Posts: 39
Accepted Solution

SAS EG and the TaskList Pipe

Hi,

 

So I came accros the ability to run commands in SAS EG, I need to do this to check for open EXCEL files, specifcally by looking for the files name. So I came across so code, which is very helpful, which I tweaked a bit.

 

filename tasks pipe "tasklist /v /fo table";

data process;
	infile tasks;
	input tasklist $500.; 

	if count(upcase(tasklist), "EXCEL") > 0 then output;
run;

This code runs fine, however, the data set doesnt hold the EXCEL files name, but just the EXCEL.EXE bit. Now if i run the CMD with tasklist /v /fo table, I can see the EXCEL files name, any idea why I do not see this in SAS? 

 

any help would be great

 

 

 


Accepted Solutions
Solution
‎10-05-2015 10:40 AM
Valued Guide
Posts: 3,208

Re: SAS EG and the TaskList Pipe

That is weird, did you check this full line print with the posted command in a dos-box?
the N/A after unknown should be the running user on the System te last N/A should be the window name.
You did not describe your environment it is running in. Eguide to SAS-local should run under your credentials but I never checked the changes that are technical hidden from the interactive (console) usage to a batch usage (No Windows).

Wiht a spawner usage on a remote Windows SAS server it the local system account getting some role introducing more differences.

Any way, your command execution did work. The information on the Windows names is not as wanted.  

https://technet.microsoft.com/en-us/library/cc730909.aspx see the remark on the remote system not having the windowtitle available.  

---->-- ja karman --<-----

View solution in original post


All Replies
Valued Guide
Posts: 3,208

Re: SAS EG and the TaskList Pipe

One pitfall could be te maximum record length als of conventions often limited to 255 https://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#chfoptfmain.htm 

Wiht a mode con  cols=255 you can make the dos-box as wide as that.  Your command will show the window name (can be set as filename). This one seems not be the problem.


The input statement seems logical understandablem but it is list input http://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n0lrz3gb7m9e4rn...

List input doesn't process lengths like column input instead  it spearates by using conventions like spaces.
You instruction is to read the first blank delimited string. That is what has been executed and what you are seeing.

Using the automatic variable _infile_ you will have the complete record  (length by lrecl).

 

 

 

---->-- ja karman --<-----
Contributor
Posts: 39

Re: SAS EG and the TaskList Pipe

Hi thanks for the response,

 

I changesd my code based on your suggestion

 

 

filename tasks pipe "tasklist /v /fo table";

options noxwait lrecl = 500;

data process;
	infile tasks;
	input tasklist $500.; 
	put _infile_;

	if count(upcase(tasklist), "EXCEL") > 0 then output;
run;

options lrecl = 256;

And still no luck, once run the log displays the EXCEL.exe applications like so 

 

EXCEL.EXE                     4844                            0    101,288 K Unknown         N/A              
                                       0:04:11 N/A                                                            

EXCEL.EXE                     5956                            0     42,072 K Unknown         N/A              
                                       0:00:16 N/A                                                            

 

 

 

Solution
‎10-05-2015 10:40 AM
Valued Guide
Posts: 3,208

Re: SAS EG and the TaskList Pipe

That is weird, did you check this full line print with the posted command in a dos-box?
the N/A after unknown should be the running user on the System te last N/A should be the window name.
You did not describe your environment it is running in. Eguide to SAS-local should run under your credentials but I never checked the changes that are technical hidden from the interactive (console) usage to a batch usage (No Windows).

Wiht a spawner usage on a remote Windows SAS server it the local system account getting some role introducing more differences.

Any way, your command execution did work. The information on the Windows names is not as wanted.  

https://technet.microsoft.com/en-us/library/cc730909.aspx see the remark on the remote system not having the windowtitle available.  

---->-- ja karman --<-----
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 291 views
  • 0 likes
  • 2 in conversation