%macro driver; data _null_; file STDOUT; put '-->'; put '<head></head>'; put '<body>'; put 'THE QUERY RETURNED NO ROWS!'; put; put '<post></body></html>'; endsas; %mend; %driver;
When I run it:
sas file.sas
Nothing comes out.
----------log-------------
4 %macro driver;
5
6
7 data _null_;
^L2 The SAS System 19:51 Wednesday, November 11, 2020
8 file STDOUT;
9 put '-->';
10 put '<head>';
11 put '<title>ADHOC QUERY RESULTS</title>';
12 put '</head>';
13 put '<body align=center bgcolor=white>';
14 put '<font color=red>THE QUERY RETURNED NO ROWS!</font>';
15 put '<post></body></html>';
16
17 endsas;
18
19 %mend;
20 ******************************************************************************************;
21
22 %driver;
NOTE: The file STDOUT is:
Filename=<standard output>
NOTE: 7 records were written to the file STDOUT.
I don't see anything on the command line like I used to in sas9.
Q: Is there an option like interactive-mode or something to make it act like sas9 output??
Thanks
Where exactly do you expect the output to appear? What's in your log?
Your code generates this log entry on my (misconfigured) server:
NOTE: The file STDOUT is:
Filename=D:\SAS\Config\Lev1\SASApp\stdout.dat,
That's where the output goes.
Oh you provided the log, sorry.
I missed it as you did not format it properly.
Where exactly do you expect this html page to appear? Browsers are typically used for rendering HTML, but I have no idea how you expect that your output will somehow be displayed.
Disclaimer: I have no grid experience.
The way I see it, sasgsub starts a SAS job on one of the grid nodes and then disconnects. This means that there is no connection to the stdout of the SAS process, and all data sent there ends up in the great bit bucket. You need to find another means (file on a shared filesystem) to get the results back to you.
But, as I said, I know next to nothing about SAS on a grid.
I am not sure what sasgsub is. I believe it might be some type of rudimentary shell script provided by SAS to submit SAS jobs to the grid. Out local system admins have made a shell script that is properly named sas that does that and I believe that whatever they did should work for what you want. At least it definitely let's us use SAS Display Manager when we call SAS without specifying a program. I believe the trick is to make sure you use the right options in the LSF commands you use to launch the SAS procedure on the grid. I have seen this referred to as interactive mode.
Let's test it. Program:
data _null_;
file STDOUT;
put '-->'
/ '<head></head>'
/ '<body>'
/ 'THE QUERY RETURNED NO ROWS!'
// '<post></body></html>'
;
run;
Terminal session:
>sas stdout Job <501095> is submitted to queue <sas-prod>. <<ssh X11 forwarding job>> <<Waiting for dispatch ...>> <<Starting on xxx.yyy.com>> --> <head></head> <body> THE QUERY RETURNED NO ROWS! <post></body></html> >
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.