Hi all,
I have a code in macro that generates regression coefficients and saved in data set ''estimates&specification". I need to turn off graphics as otherwise the code takes ages to run. My problem is that, when I run in %DO loop, the code returns errors with the warning message:
WARNING: Output 'ParameterEstimates' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used.
WARNING: The current ODS SELECT/EXCLUDE/OUTPUT statement was cleared because the end of a procedure step was detected. Probable causes for this include the non-termination of an interactive procedure (type quit; to end the procedure) and a run group with no output.
This is puzzling as the code works if I take it out of DO loop in macro. Any help would be appreciated.
>>>>>>>>>>
ods listing exclude all;
ods graphics off;
ods output ParameterEstimates=estimates&specification (keep= Date Variable DF Estimate Probt);
proc reg data=temp;
by Date;
model Return1Month = &RHS;
quit;
ods listing exclude none;
Are these the only WARNINGs (or ERRORs) that you get, or do you get any "abnormal" message from the REG procedure itself?
How do you set macro variable &RHS?
Hi Kurt,
Thanks much for your reply. &RHS is set at the beginning of %DO loop.
Yes, these are the only warning I got. Of course, the rest of the codes also screw up because they do not find ''estiamtes&specification".
%DO specification = 1 %TO 5;
%if &dataset = quintiles %then %do;
%if &specification = 1 %then %let RHS= BondBookToMarketQ2-BondBookToMarketQ5;
%else %if &specification = 2 %then %let RHS= BondBookToMarketQ2-BondBookToMarketQ5
BondValueQ2-BondValueQ5 BondAgeQ2-BondAgeQ5 BondMaturityQ2-BondMaturityQ5
BondBidAskSpreadQ2-BondBidAskSpreadQ5
BondReversalQ2-BondReversalQ5 BondMomentum26Q2-BondMomentum26Q5;
%else %if &specification = 3 %then %let RHS= BondYieldQ2-BondYieldQ5;
%else %if &specification = 4 %then %let RHS= BondYieldQ2-BondYieldQ5
BondValueQ2-BondValueQ5 BondAgeQ2-BondAgeQ5 BondMaturityQ2-BondMaturityQ5
BondBidAskSpreadQ2-BondBidAskSpreadQ5
BondReversalQ2-BondReversalQ5 BondMomentum26Q2-BondMomentum26Q5;
%else %if &specification = 5 %then %let RHS= BondBookToMarketQ2-BondBookToMarketQ5 BondYieldQ2-BondYieldQ5
BondValueQ2-BondValueQ5 BondAgeQ2-BondAgeQ5 BondMaturityQ2-BondMaturityQ5
BondBidAskSpreadQ2-BondBidAskSpreadQ5
BondReversalQ2-BondReversalQ5 BondMomentum26Q2-BondMomentum26Q5;
%end;
Insert %PUT statements right before the PROC REG that display the values of all macro variables used in the proc step. Then, inspect the log at which of your iterations the problem arises, and then run the step manually with the exact same parameters (without any use of macro variables).
Do loop runs from specification 1 to 5, and all iterations from 2 to 5 show the same warning message.
When I copied the code inside the Do loop, set "%let specification=2;", and then it runs without any problems...
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.