|
|
Error handling for interactive stored processes
I am moving some SAS 9 static reports to parameterized SAS EBI reports
accessed through Web Portal. If the user enters parameters that yield
no results, there is no output (for PROC PRINT, for example): this may
lead the user to believe the system is broken. I made a macro to check
for no observations, but I don't see a good way to display the error
message to the user (apparently through ODS).
I've tried various methods including
#1
ODS text='There are no results: try different parameters'
But SAS doesn't flush the output, so this is never displayed on its
own.
#2
data _null_;
input lines $ 1-80;
file print;
put _infile_;
cards;
There are no results: try different parameters
run;
But cards is not allowed in a macro (which I need to check the count
of observations)
Andrew
|
|
0
|
|
|
|
Reply
|
ahz001 (21)
|
8/3/2010 7:15:22 PM |
|
On Aug 3, 12:15=A0pm, "Andrew Z." <ahz...@gmail.com> wrote:
> I am moving some SAS 9 static reports to parameterized SAS EBI reports
> accessed through Web Portal. =A0If the user enters parameters that yield
> no results, there is no output (for PROC PRINT, for example): this may
> lead the user to believe the system is broken. I made a macro to check
> for no observations, but I don't see a good way to display the error
> message to the user (apparently through ODS).
>
> I've tried various methods including
>
> #1
> ODS text=3D'There are no results: try different parameters'
>
> But SAS doesn't flush the output, so this is never displayed on its
> own.
>
> #2
> data _null_;
> =A0 =A0 input lines $ 1-80;
> =A0 =A0 file print;
> =A0 =A0 put _infile_;
> cards;
> There are no results: try different parameters
> run;
>
> But cards is not allowed in a macro (which I need to check the count
> of observations)
>
> Andrew
How about this?
data _null_;
file print;
put "There are no results: try different parameters";
run;
Ya
|
|
0
|
|
|
|
Reply
|
huang8012 (266)
|
8/3/2010 7:19:25 PM
|
|
On Aug 3, 1:19=A0pm, Ya <huang8...@gmail.com> wrote:
> On Aug 3, 12:15=A0pm, "Andrew Z." <ahz...@gmail.com> wrote:
>
>
>
> > I am moving some SAS 9 static reports to parameterized SAS EBI reports
> > accessed through Web Portal. =A0If the user enters parameters that yiel=
d
> > no results, there is no output (for PROC PRINT, for example): this may
> > lead the user to believe the system is broken. I made a macro to check
> > for no observations, but I don't see a good way to display the error
> > message to the user (apparently through ODS).
>
> > I've tried various methods including
>
> > #1
> > ODS text=3D'There are no results: try different parameters'
>
> > But SAS doesn't flush the output, so this is never displayed on its
> > own.
>
> > #2
> > data _null_;
> > =A0 =A0 input lines $ 1-80;
> > =A0 =A0 file print;
> > =A0 =A0 put _infile_;
> > cards;
> > There are no results: try different parameters
> > run;
>
> > But cards is not allowed in a macro (which I need to check the count
> > of observations)
>
> How about this?
>
> data _null_;
> =A0 =A0 =A0file print;
> =A0 =A0 =A0put "There are no results: try different parameters";
> run;
The log shows it executes, but ODS doesn't show any output.
NOTE: 1 lines were written to file PRINT.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.00 seconds
I also tried this
data _null_;
set sashelp.class;
if _n_ =3D 1
then
do;
declare odsout obj();
obj.format_text(data: "bla .. bla..");
end;
obj.format_text(data: name);
run;
https://groups.google.com/group/comp.soft-sys.sas/msg/ba35283eab034e48
Which gives the following log but still no output
WARNING: DATA step interface is preproduction in this release.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
Andrew
|
|
0
|
|
|
|
Reply
|
ahz001 (21)
|
8/3/2010 7:58:32 PM
|
|
On Aug 3, 12:58=A0pm, "Andrew Z." <ahz...@gmail.com> wrote:
> On Aug 3, 1:19=A0pm, Ya <huang8...@gmail.com> wrote:
>
>
>
>
>
> > On Aug 3, 12:15=A0pm, "Andrew Z." <ahz...@gmail.com> wrote:
>
> > > I am moving some SAS 9 static reports to parameterized SAS EBI report=
s
> > > accessed through Web Portal. =A0If the user enters parameters that yi=
eld
> > > no results, there is no output (for PROC PRINT, for example): this ma=
y
> > > lead the user to believe the system is broken. I made a macro to chec=
k
> > > for no observations, but I don't see a good way to display the error
> > > message to the user (apparently through ODS).
>
> > > I've tried various methods including
>
> > > #1
> > > ODS text=3D'There are no results: try different parameters'
>
> > > But SAS doesn't flush the output, so this is never displayed on its
> > > own.
>
> > > #2
> > > data _null_;
> > > =A0 =A0 input lines $ 1-80;
> > > =A0 =A0 file print;
> > > =A0 =A0 put _infile_;
> > > cards;
> > > There are no results: try different parameters
> > > run;
>
> > > But cards is not allowed in a macro (which I need to check the count
> > > of observations)
>
> > How about this?
>
> > data _null_;
> > =A0 =A0 =A0file print;
> > =A0 =A0 =A0put "There are no results: try different parameters";
> > run;
>
> The log shows it executes, but ODS doesn't show any output.
>
> NOTE: 1 lines were written to file PRINT.
> NOTE: DATA statement used (Total process time):
> =A0 =A0 =A0 real time =A0 =A0 =A0 =A0 =A0 0.02 seconds
> =A0 =A0 =A0 cpu time =A0 =A0 =A0 =A0 =A0 =A00.00 seconds
>
> I also tried this
>
> data _null_;
> =A0 =A0 =A0 =A0set sashelp.class;
> =A0 =A0 =A0 =A0if _n_ =3D 1
> =A0 =A0 =A0 =A0then
> =A0 =A0 =A0 =A0 =A0 do;
> =A0 =A0 =A0 =A0 =A0declare odsout obj();
> =A0 =A0 =A0 =A0 =A0obj.format_text(data: "bla .. bla..");
> =A0 =A0 =A0 =A0 =A0end;
> =A0 =A0 =A0 obj.format_text(data: name);
> =A0 =A0run;
>
> https://groups.google.com/group/comp.soft-sys.sas/msg/ba35283eab034e48
>
> Which gives the following log but still no output
>
> WARNING: DATA step interface is preproduction in this release.
> NOTE: DATA statement used (Total process time):
> =A0 =A0 =A0 real time =A0 =A0 =A0 =A0 =A0 0.02 seconds
> =A0 =A0 =A0 cpu time =A0 =A0 =A0 =A0 =A0 =A00.01 seconds
>
> NOTE: There were 19 observations read from the data set SASHELP.CLASS.
>
> Andrew- Hide quoted text -
>
> - Show quoted text -
The way you use ods data step interface is not quite right, you need
table_start(), tabel_end() statement.
A more simple way would be using proc print:
data dum;
a=3D"There are no results: try different parameters";
run;
ods ...
proc print data=3Ddum noobs label;
label a=3D'A0'x;
run;
ods ... close;
|
|
0
|
|
|
|
Reply
|
huang8012 (266)
|
8/3/2010 8:09:07 PM
|
|
|
3 Replies
360 Views
(page loaded in 0.012 seconds)
|
|
|
|
|
|
|
|
|