BookmarkSubscribeRSS Feed
MarkMcCluskey
Fluorite | Level 6

I have a ODS Document that I've created to catch a lot of output (e.g. work.largedoc in example below), which needs to get parsed into several artifacts for documentation purposes (e.g. work.smalldoc in the example below) using the DOC statement in PROC DOCUMENT.  The following is a sample set of instructions I use to parse the large document into smaller ones.

 

proc document name=work.largedoc;
 doc name=work.smalldoc(write);

 make \work.smalldoc\Model1#1 / last;
 copy
  \work.largedoc\Arima#1\Estimate#1\ParameterEstimates#1
, \work.largedoc\Arima#1\Estimate#1\FitStatistics#1
 to \work.smalldoc\Model1#1 / last;
*other things copied to file;

 obtitle \work.smalldoc\Model1#1\ParameterEstimates#1 "Forecasts from Outcome Analysis";
 obbnote \work.smalldoc\Model1#1\ParameterEstimates#1 "Model using initial set of input variables";

doc close;
run;

 

If I don't add the OBBNOTE, the FitStatistics#1 table appears as expected when I use REPLAY within another PROC DOCUMENT call.  However, the FitStatistics#1 table goes missing is the OBBNOTE statement is used.

 

I'm trying to build a process that avoids needing secondary text processing, but I need to reference that Fit Statistics table, so I cannot afford for it to go missing.  What do I need to do to fix this?

3 REPLIES 3
ballardw
Super User

It would help to provide an example using something with data we could use to duplicate the behavior such as the Proc Document examples us the SASHELP.Class data set and proc contents output.

 

 

MarkMcCluskey
Fluorite | Level 6

Here is code illustrating my problem:

 

ods graphics on;
ods document name=work.largedoc(write);
*Airline model example;
data work.airlocal(drop=i);
 format date date9.;
 set sashelp.air;
 t = _N_;
 lg_air = log(air);
 output;
 if _N_ eq 144 then do;
  do i = 1 to 24;
   date=intnx('month','31DEC1960'd,i,'end');
   t=144+i;
   air=.;
   lg_air=.;
   output;
  end;
 end;
run;
proc arima data=work.airlocal(
 rename=(
  air      = y
  lg_air   = lg_y
 )
);
 identify var=lg_y stationarity=(PP) crosscorr=(t);
 estimate input=(t) p=(1)(12) q=(12);
 forecast id=t lead=24 out=work.fcst;
run;
data work.fcst;
 set work.fcst;
 air     = exp(lg_y);
 air_f   = exp(forecast+0.5*STD**2);
 air_l95 = exp(l95);
 air_u95 = exp(u95);
run;
proc sgplot data=work.fcst;
 scatter x=t y=air ;
 series  x=t y=air_f;
 band    x=t lower=air_l95 upper=air_u95 / transparency=.80;
run;
ods document close;

proc document name=work.largedoc;
 list / levels=all details;
run;

*Selecting only the ARIMA parameter table and fit statistics table;
proc document name=work.largedoc;
 doc name=work.smalldoc(write);
 make \work.smalldoc\Fit#1;
 copy \work.largedoc\Arima#1\Estimate#1\ParameterEstimates#1
     ,\work.largedoc\Arima#1\Estimate#1\FitStatistics#1
 to \work.smalldoc\Fit#1 / last;
 doc close;
run;

*Both show in replay;
proc document name=work.smalldoc;
 replay;
run;

*OBBNOTE added and fit statistics table goes missing;
proc document name=work.smalldoc;
 obbnote \Fit#1\ParameterEstimates#1 "This note";
 replay;
run;

 

Why does adding an OBBNOTE hide the contents?

MarkMcCluskey
Fluorite | Level 6

Using the above example code, this doesn't even work.

*Split the two tables into two separate directories;
proc document name=work.largedoc;
 doc name=work.smalldoc(write);
 make \work.smalldoc\PEST#1;
 copy \work.largedoc\Arima#1\Estimate#1\ParameterEstimates#1
 to \work.smalldoc\PEST#1 / last;
 make \work.smalldoc\Fit#1;
 copy \work.largedoc\Arima#1\Estimate#1\FitStatistics#1
 to \work.smalldoc\Fit#1 / last;
 doc close;
run;

*Both appear as expected;
proc document name=work.smalldoc;
 replay;
run;

*Fit statistics table is missing, though the "The ARIMA Procedure" proctitle appears;
proc document name=work.smalldoc;
 obbnote \PEST#1\ParameterEstimates#1 "This note";
 replay \PEST#1;
 replay \Fit#1;
run;

 

I'm now at a loss.

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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