BookmarkSubscribeRSS Feed
amrshd
Fluorite | Level 6

Hi, I want to create an HTML output for each response variable for each selection method I.e. stepwise, backwards, forwards etc.

7 REPLIES 7
djrisks
Barite | Level 11

Hello, does this work?

ods html file = "<file location and name>";

<procedure>

ods html close;

amrshd
Fluorite | Level 6


Hi, The actual requirement is as below:

Proc reg data = dsn;

model Y = x1 x2 x3 x4.....xn /selection =stepwise slstay=0.05 slentry=0.05;

run;

Proc reg data = dsn;

model Y = x1 x2 x3 x4.....xn /selection =backwards slstay=0.05 slentry=0.05;

run;

So, for each of the response variable I want to generate a seperate html file and save the output as - Y_X1_stepwise.html, Y_X2_stepwise ....etc.

I want individual html file for each response variable with method name.

Thanks for your help!

djrisks
Barite | Level 11

Hi, when you say response, do you mean your Y variable?

amrshd
Fluorite | Level 6

Yes... For each Y (response variable) and its interaction with each X variable.

djrisks
Barite | Level 11

Okay, then the best way is to make sure everything is in one dataset and then use a Macro.

For example:

ods html file = <file location>/&filename;

%macro response(response, filename);

Proc reg data = dsn;

by <group variable>; /* Group should be your variable that differentiates the responses */

where <group variable> = &response.; /* Response is the label that you have chosen to identify each group */

model Y = x1 x2 x3 x4.....xn /selection =stepwise slstay=0.05 slentry=0.05;

model Y = x1 x2 x3 x4.....xn /selection =backwards slstay=0.05 slentry=0.05;

run;


%mend;


%response(group1, Y1_stepwise)

%response(group1, Y1_backwards)

%response(group2, Y2_stepwise)

%response(group2, Y2_backwards)


I haven't got SAS on my computer, so couldn't test it. I hope you understand it though. The key thing is to create a Macro, so that you can expliciity label your output filenames easier.

amrshd
Fluorite | Level 6

Thanks I will try this and let you know if this works

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1900 views
  • 1 like
  • 2 in conversation