I am using PROC LOGISTIC on multiple datasets , for this I am using macro. Is there a way so I can export the results to excel sheet for each dataset.
I tried using ODS TAGSETS.Excelxp, but not working:
ods graphics on;
proc logistic data=&in_ds. ALPHA=0.05 outmodel=DS_MDL;
class var1 var2 var3;
model y=x / options;
score data=&in_ds. out=ds_scr;
ods graphics off;
OPTIONS ( Orientation = 'landscape'
FitToPage = 'yes'
Pages_FitWidth = '1'
Pages_FitHeight = '100' );
ODS TAGSETS.EXCELXP close;
I want to create separate reports for 3 datasets, the report name can be passed as a parameter to macro.
Use the dark and forgotten art of by group processing.
ods tagsets.excelxp file='d:/worksas9regression.xml' style=minimal options(orientation='landscape' fittopage='yes' pages_fitwidth='1' pages_fitheight='100'); data have; length ds_name $20; set dataset1 dataset2 dataset3 indsname=tmp; ds_name=tmp; run; ods graphics on; proc logistic data=have alpha=0.05 outtmodel=ds_mdl; by ds_name; class var1 var2 var3; model y=x / options; score data=have; run; ods graphics off;
ods tagsets.excelxp close;
Do note I have corrected the various typos, the random casing, lack of indents etc. I also called the filename xml which is what you are actually creating here by use of a tagset. Also note in the tagset options you may need to set sheet_inteval='bygroup'. As I have nothing to test this on it isn't tested.
Pleas post some test data, and code which accurately reflect what you have, we can only go on what you post here. Your error is to do with gpath:
If the datasets are different and the variables are different, how are you aiming to get the different variables into the macro code? If the same variables are being used in the model each time, just keep them in the dataset. If they are different variables then show how this will go into the macro.
%macro build_model(in_dset); ods graphics on; proc logistic data=&in_dset. ALPHA=0.05 /*&model_plots.*/ outmodel=ds_MDL; class &list_class_vars.; model DEFAULT_FLAG(EVENT='1')=&list_loan_vars. &selected_macroeconomic_vars. / &model_opts.; score data=&in_dset. out=ds_SCR; run; ods graphics off; %mend build_model; %let plot_path = /home/../../../reports; ods tagsets.ExcelXP file="&plot_path./report.xml" style=minimal options(orientation='landscape' FittoPage = 'yes' Pages_FitWidth ='1' Pages_FitHeight = '100'); %build_model(dataset1); ods tagsets.ExcelXP close; error message: NOTE: Convergence criterion (GCONV=1E-8) satisfied in Step 17. NOTE: Convergence criterion (GCONV=1E-8) satisfied in Step 18. NOTE: Convergence criterion (GCONV=1E-8) satisfied in Step 19. NOTE: Convergence criterion (GCONV=1E-8) satisfied in Step 20. WARNING: GPATH or PATH is not a writable directory. It will be ignored. ERROR: Cannot write image to . Please ensure that proper disk permissions are set. ERROR: Cannot write image to . Please ensure that proper disk permissions are set. NOTE: The SAS System stopped processing this step because of errors.
Please find my code and error messages.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.